@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
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
-
7
- const getItemAsync = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
8
- if (typeof window === 'undefined') {
9
- return undefined;
10
- }
11
- return window.localStorage.getItem(key) || undefined;
12
- });
13
- const setItemAsync = (key, value) => tslib.__awaiter(void 0, void 0, void 0, function* () {
14
- if (typeof window === 'undefined') {
15
- return undefined;
16
- }
17
- return window.localStorage.setItem(key, value);
18
- });
19
- const removeItemAsync = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
20
- if (typeof window === 'undefined') {
21
- return undefined;
22
- }
23
- return localStorage.removeItem(key);
24
- });
25
-
26
- exports.getItemAsync = getItemAsync;
27
- exports.removeItemAsync = removeItemAsync;
28
- exports.setItemAsync = setItemAsync;
@@ -1,3 +0,0 @@
1
- export declare const getItemAsync: (key: string) => Promise<string | undefined>;
2
- export declare const setItemAsync: (key: string, value: string) => Promise<void>;
3
- export declare const removeItemAsync: (key: string) => Promise<void>;
@@ -1,22 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
-
3
- const getItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
4
- if (typeof window === 'undefined') {
5
- return undefined;
6
- }
7
- return window.localStorage.getItem(key) || undefined;
8
- });
9
- const setItemAsync = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
10
- if (typeof window === 'undefined') {
11
- return undefined;
12
- }
13
- return window.localStorage.setItem(key, value);
14
- });
15
- const removeItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
16
- if (typeof window === 'undefined') {
17
- return undefined;
18
- }
19
- return localStorage.removeItem(key);
20
- });
21
-
22
- export { getItemAsync, removeItemAsync, setItemAsync };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var logger$1 = require('@dynamic-labs/logger');
6
-
7
- const logger = new logger$1.Logger('WalletConnector');
8
-
9
- exports.logger = logger;
@@ -1,2 +0,0 @@
1
- import { Logger } from '@dynamic-labs/logger';
2
- export declare const logger: Logger;
@@ -1,5 +0,0 @@
1
- import { Logger } from '@dynamic-labs/logger';
2
-
3
- const logger = new Logger('WalletConnector');
4
-
5
- export { logger };
@@ -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,30 +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 = (evmNetworks, 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
- let connector;
16
- // justification: we filtered out null/undefined above
17
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
- if (isV2Enabled && ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
19
- connector = new walletConnectV2({
20
- evmNetworks,
21
- walletName: name,
22
- });
23
- }
24
- else {
25
- connector = new walletConnect({ evmNetworks, walletName: name });
26
- }
27
- return connector;
28
- });
29
-
30
- exports.fetchWalletConnectWallets = fetchWalletConnectWallets;
@@ -1,4 +0,0 @@
1
- import WalletConnect from '../wallets/walletConnect';
2
- import { EvmNetwork } from '../wallets/ethereum/evm-network';
3
- import WalletConnectV2 from '../wallets/walletConnect/walletConnectV2';
4
- export declare const fetchWalletConnectWallets: (evmNetworks: EvmNetwork[], isV2Enabled: boolean) => (WalletConnectV2 | WalletConnect)[];
@@ -1,26 +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 = (evmNetworks, 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
- let connector;
12
- // justification: we filtered out null/undefined above
13
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14
- if (isV2Enabled && ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
15
- connector = new WalletConnectV2({
16
- evmNetworks,
17
- walletName: name,
18
- });
19
- }
20
- else {
21
- connector = new WalletConnect({ evmNetworks, walletName: name });
22
- }
23
- return connector;
24
- });
25
-
26
- 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,149 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib = require('tslib');
4
- var MyAlgoConnect = require('@randlabs/myalgo-connect');
5
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
6
- var errors = require('../../errors.cjs');
7
- var localStorageAsync = require('../../utils/localStorageAsync.cjs');
8
- var myalgoSigner = require('./myalgoSigner.cjs');
9
-
10
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
-
12
- var MyAlgoConnect__default = /*#__PURE__*/_interopDefaultLegacy(MyAlgoConnect);
13
-
14
- const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
15
- const HTTP_STATUS_NOT_FOUND = 404;
16
- class MyAlgoLocalStorageCache {
17
- constructor() {
18
- this.SESSION_STORAGE_KEY = 'algorand_myalgo_currentAddress';
19
- this.LAST_BALANCE_KEY = 'algorand_myalgo_lastBalance';
20
- }
21
- getCurrentAddress() {
22
- return tslib.__awaiter(this, void 0, void 0, function* () {
23
- const addr = yield localStorageAsync.getItemAsync(this.SESSION_STORAGE_KEY);
24
- if (!addr) {
25
- return undefined;
26
- }
27
- return addr;
28
- });
29
- }
30
- setCurrentAddress(addr) {
31
- return tslib.__awaiter(this, void 0, void 0, function* () {
32
- localStorageAsync.setItemAsync(this.SESSION_STORAGE_KEY, addr);
33
- });
34
- }
35
- clearCurrentAddress() {
36
- return tslib.__awaiter(this, void 0, void 0, function* () {
37
- localStorageAsync.removeItemAsync(this.SESSION_STORAGE_KEY);
38
- });
39
- }
40
- getLastBalance() {
41
- return tslib.__awaiter(this, void 0, void 0, function* () {
42
- const balance = yield localStorageAsync.getItemAsync(this.LAST_BALANCE_KEY);
43
- if (!balance) {
44
- return undefined;
45
- }
46
- return balance;
47
- });
48
- }
49
- setLastBalance(balance) {
50
- return tslib.__awaiter(this, void 0, void 0, function* () {
51
- localStorageAsync.setItemAsync(this.LAST_BALANCE_KEY, balance);
52
- });
53
- }
54
- }
55
- class MyAlgoWalletConnector extends walletConnectorCore.WalletConnectorBase {
56
- constructor() {
57
- super();
58
- this.name = 'MyAlgo';
59
- this.canConnectViaCustodialService = true;
60
- this.connectedChain = 'ALGO';
61
- this.supportedChains = ['ALGO'];
62
- this.cache = new MyAlgoLocalStorageCache();
63
- }
64
- getClient() {
65
- if (!this.client) {
66
- this.client = new MyAlgoConnect__default["default"]();
67
- }
68
- return this.client;
69
- }
70
- getNetwork() {
71
- return tslib.__awaiter(this, void 0, void 0, function* () {
72
- return undefined;
73
- });
74
- }
75
- getDeepLink() {
76
- return undefined;
77
- }
78
- fetchPublicAddress() {
79
- return tslib.__awaiter(this, void 0, void 0, function* () {
80
- const currentAddress = yield this.cache.getCurrentAddress();
81
- if (currentAddress) {
82
- return currentAddress;
83
- }
84
- const accounts = yield this.getClient().connect({
85
- shouldSelectOneAccount: true,
86
- });
87
- if (accounts.length > 0) {
88
- const [{ address }] = accounts;
89
- yield this.cache.setCurrentAddress(address);
90
- return address;
91
- }
92
- return '';
93
- });
94
- }
95
- getSigner() {
96
- return tslib.__awaiter(this, void 0, void 0, function* () {
97
- const address = yield this.fetchPublicAddress();
98
- if (!address)
99
- throw new errors.DynamicError('MyAlgo Wallet Connector - Not connected!');
100
- return new myalgoSigner.MyAlgoSigner(address, this.getClient());
101
- });
102
- }
103
- signMessage(messageToSign) {
104
- return tslib.__awaiter(this, void 0, void 0, function* () {
105
- const signer = yield this.getSigner();
106
- const signature = yield signer.signBytes(Buffer.from(messageToSign));
107
- return Buffer.from(signature).toString('hex');
108
- });
109
- }
110
- getBalance() {
111
- return tslib.__awaiter(this, void 0, void 0, function* () {
112
- const address = yield this.fetchPublicAddress();
113
- if (!address)
114
- throw new errors.DynamicError('getBalance - Not connected!');
115
- const response = yield fetch(`https://indexer.algoexplorerapi.io/v2/accounts/${address}`);
116
- if (!response.ok) {
117
- // if the request fails due to rate limits, return cached value
118
- if (response.status === HTTP_STATUS_TOO_MANY_REQUESTS) {
119
- return this.cache.getLastBalance();
120
- }
121
- // new accounts not yet indexed will return a 404
122
- if (response.status === HTTP_STATUS_NOT_FOUND) {
123
- return '0';
124
- }
125
- return undefined;
126
- }
127
- const accountInfo = yield response.json();
128
- if (!accountInfo.account) {
129
- return undefined;
130
- }
131
- const balance = accountInfo.account.amount.toString();
132
- yield this.cache.setLastBalance(balance.toString());
133
- return balance.toString();
134
- });
135
- }
136
- endSession() {
137
- return tslib.__awaiter(this, void 0, void 0, function* () {
138
- yield this.cache.clearCurrentAddress();
139
- });
140
- }
141
- getConnectedAccounts() {
142
- return tslib.__awaiter(this, void 0, void 0, function* () {
143
- const currentAddress = yield this.cache.getCurrentAddress();
144
- return currentAddress ? [currentAddress] : [];
145
- });
146
- }
147
- }
148
-
149
- module.exports = MyAlgoWalletConnector;
@@ -1,21 +0,0 @@
1
- import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
2
- import { IMyAlgoSigner } from './myalgoSigner';
3
- declare class MyAlgoWalletConnector extends WalletConnectorBase {
4
- private client?;
5
- private cache;
6
- name: string;
7
- canConnectViaCustodialService: boolean;
8
- connectedChain: Chain;
9
- supportedChains: Chain[];
10
- constructor();
11
- private getClient;
12
- getNetwork(): Promise<number | undefined>;
13
- getDeepLink(): string | undefined;
14
- fetchPublicAddress(): Promise<string | undefined>;
15
- getSigner(): Promise<IMyAlgoSigner>;
16
- signMessage(messageToSign: string): Promise<string | undefined>;
17
- getBalance(): Promise<string | undefined>;
18
- endSession(): Promise<void>;
19
- getConnectedAccounts(): Promise<string[]>;
20
- }
21
- export default MyAlgoWalletConnector;
@@ -1,143 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import MyAlgoConnect from '@randlabs/myalgo-connect';
3
- import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
4
- import { DynamicError } from '../../errors.js';
5
- import { getItemAsync, setItemAsync, removeItemAsync } from '../../utils/localStorageAsync.js';
6
- import { MyAlgoSigner } from './myalgoSigner.js';
7
-
8
- const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
9
- const HTTP_STATUS_NOT_FOUND = 404;
10
- class MyAlgoLocalStorageCache {
11
- constructor() {
12
- this.SESSION_STORAGE_KEY = 'algorand_myalgo_currentAddress';
13
- this.LAST_BALANCE_KEY = 'algorand_myalgo_lastBalance';
14
- }
15
- getCurrentAddress() {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const addr = yield getItemAsync(this.SESSION_STORAGE_KEY);
18
- if (!addr) {
19
- return undefined;
20
- }
21
- return addr;
22
- });
23
- }
24
- setCurrentAddress(addr) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- setItemAsync(this.SESSION_STORAGE_KEY, addr);
27
- });
28
- }
29
- clearCurrentAddress() {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- removeItemAsync(this.SESSION_STORAGE_KEY);
32
- });
33
- }
34
- getLastBalance() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const balance = yield getItemAsync(this.LAST_BALANCE_KEY);
37
- if (!balance) {
38
- return undefined;
39
- }
40
- return balance;
41
- });
42
- }
43
- setLastBalance(balance) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- setItemAsync(this.LAST_BALANCE_KEY, balance);
46
- });
47
- }
48
- }
49
- class MyAlgoWalletConnector extends WalletConnectorBase {
50
- constructor() {
51
- super();
52
- this.name = 'MyAlgo';
53
- this.canConnectViaCustodialService = true;
54
- this.connectedChain = 'ALGO';
55
- this.supportedChains = ['ALGO'];
56
- this.cache = new MyAlgoLocalStorageCache();
57
- }
58
- getClient() {
59
- if (!this.client) {
60
- this.client = new MyAlgoConnect();
61
- }
62
- return this.client;
63
- }
64
- getNetwork() {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- return undefined;
67
- });
68
- }
69
- getDeepLink() {
70
- return undefined;
71
- }
72
- fetchPublicAddress() {
73
- return __awaiter(this, void 0, void 0, function* () {
74
- const currentAddress = yield this.cache.getCurrentAddress();
75
- if (currentAddress) {
76
- return currentAddress;
77
- }
78
- const accounts = yield this.getClient().connect({
79
- shouldSelectOneAccount: true,
80
- });
81
- if (accounts.length > 0) {
82
- const [{ address }] = accounts;
83
- yield this.cache.setCurrentAddress(address);
84
- return address;
85
- }
86
- return '';
87
- });
88
- }
89
- getSigner() {
90
- return __awaiter(this, void 0, void 0, function* () {
91
- const address = yield this.fetchPublicAddress();
92
- if (!address)
93
- throw new DynamicError('MyAlgo Wallet Connector - Not connected!');
94
- return new MyAlgoSigner(address, this.getClient());
95
- });
96
- }
97
- signMessage(messageToSign) {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- const signer = yield this.getSigner();
100
- const signature = yield signer.signBytes(Buffer.from(messageToSign));
101
- return Buffer.from(signature).toString('hex');
102
- });
103
- }
104
- getBalance() {
105
- return __awaiter(this, void 0, void 0, function* () {
106
- const address = yield this.fetchPublicAddress();
107
- if (!address)
108
- throw new DynamicError('getBalance - Not connected!');
109
- const response = yield fetch(`https://indexer.algoexplorerapi.io/v2/accounts/${address}`);
110
- if (!response.ok) {
111
- // if the request fails due to rate limits, return cached value
112
- if (response.status === HTTP_STATUS_TOO_MANY_REQUESTS) {
113
- return this.cache.getLastBalance();
114
- }
115
- // new accounts not yet indexed will return a 404
116
- if (response.status === HTTP_STATUS_NOT_FOUND) {
117
- return '0';
118
- }
119
- return undefined;
120
- }
121
- const accountInfo = yield response.json();
122
- if (!accountInfo.account) {
123
- return undefined;
124
- }
125
- const balance = accountInfo.account.amount.toString();
126
- yield this.cache.setLastBalance(balance.toString());
127
- return balance.toString();
128
- });
129
- }
130
- endSession() {
131
- return __awaiter(this, void 0, void 0, function* () {
132
- yield this.cache.clearCurrentAddress();
133
- });
134
- }
135
- getConnectedAccounts() {
136
- return __awaiter(this, void 0, void 0, function* () {
137
- const currentAddress = yield this.cache.getCurrentAddress();
138
- return currentAddress ? [currentAddress] : [];
139
- });
140
- }
141
- }
142
-
143
- export { MyAlgoWalletConnector as default };
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class MyAlgoSigner {
6
- constructor(connectedAddress, client) {
7
- this.connectedAddress = connectedAddress;
8
- this.client = client;
9
- }
10
- signBytes(bytes) {
11
- return this.client.signBytes(bytes, this.connectedAddress);
12
- }
13
- signLogicSig(teal) {
14
- return this.client.signLogicSig(teal, this.connectedAddress);
15
- }
16
- signTransaction(txs) {
17
- return this.client.signTransaction(txs);
18
- }
19
- tealSign(data, contractAddress) {
20
- return this.client.tealSign(data, contractAddress, this.connectedAddress);
21
- }
22
- }
23
-
24
- exports.MyAlgoSigner = MyAlgoSigner;
@@ -1,21 +0,0 @@
1
- import MyAlgoConnect from '@randlabs/myalgo-connect';
2
- interface AlgorandSignedTx {
3
- blob: Uint8Array;
4
- txID: string;
5
- }
6
- export interface IMyAlgoSigner {
7
- signBytes(bytes: Uint8Array): Promise<Uint8Array>;
8
- signLogicSig(teal: Uint8Array): Promise<Uint8Array>;
9
- signTransaction(txs: any[]): Promise<AlgorandSignedTx[]>;
10
- tealSign(data: Uint8Array, contractAddress: string): Promise<Uint8Array>;
11
- }
12
- export declare class MyAlgoSigner implements IMyAlgoSigner {
13
- private readonly connectedAddress;
14
- private readonly client;
15
- constructor(connectedAddress: string, client: MyAlgoConnect);
16
- signBytes(bytes: Uint8Array): Promise<Uint8Array>;
17
- signLogicSig(teal: Uint8Array): Promise<Uint8Array>;
18
- signTransaction(txs: any[]): Promise<AlgorandSignedTx[]>;
19
- tealSign(data: Uint8Array, contractAddress: string): Promise<Uint8Array>;
20
- }
21
- export {};
@@ -1,20 +0,0 @@
1
- class MyAlgoSigner {
2
- constructor(connectedAddress, client) {
3
- this.connectedAddress = connectedAddress;
4
- this.client = client;
5
- }
6
- signBytes(bytes) {
7
- return this.client.signBytes(bytes, this.connectedAddress);
8
- }
9
- signLogicSig(teal) {
10
- return this.client.signLogicSig(teal, this.connectedAddress);
11
- }
12
- signTransaction(txs) {
13
- return this.client.signTransaction(txs);
14
- }
15
- tealSign(data, contractAddress) {
16
- return this.client.tealSign(data, contractAddress, this.connectedAddress);
17
- }
18
- }
19
-
20
- export { MyAlgoSigner };