@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,355 +0,0 @@
1
- var ETH_CONTRACT_ABI = [
2
- {
3
- members: [
4
- {
5
- name: "low",
6
- offset: 0,
7
- type: "felt"
8
- },
9
- {
10
- name: "high",
11
- offset: 1,
12
- type: "felt"
13
- }
14
- ],
15
- name: "Uint256",
16
- size: 2,
17
- type: "struct"
18
- },
19
- {
20
- data: [
21
- {
22
- name: "from_",
23
- type: "felt"
24
- },
25
- {
26
- name: "to",
27
- type: "felt"
28
- },
29
- {
30
- name: "value",
31
- type: "Uint256"
32
- }
33
- ],
34
- keys: [
35
- ],
36
- name: "Transfer",
37
- type: "event"
38
- },
39
- {
40
- data: [
41
- {
42
- name: "owner",
43
- type: "felt"
44
- },
45
- {
46
- name: "spender",
47
- type: "felt"
48
- },
49
- {
50
- name: "value",
51
- type: "Uint256"
52
- }
53
- ],
54
- keys: [
55
- ],
56
- name: "Approval",
57
- type: "event"
58
- },
59
- {
60
- inputs: [
61
- ],
62
- name: "name",
63
- outputs: [
64
- {
65
- name: "name",
66
- type: "felt"
67
- }
68
- ],
69
- stateMutability: "view",
70
- type: "function"
71
- },
72
- {
73
- inputs: [
74
- ],
75
- name: "symbol",
76
- outputs: [
77
- {
78
- name: "symbol",
79
- type: "felt"
80
- }
81
- ],
82
- stateMutability: "view",
83
- type: "function"
84
- },
85
- {
86
- inputs: [
87
- ],
88
- name: "totalSupply",
89
- outputs: [
90
- {
91
- name: "totalSupply",
92
- type: "Uint256"
93
- }
94
- ],
95
- stateMutability: "view",
96
- type: "function"
97
- },
98
- {
99
- inputs: [
100
- ],
101
- name: "decimals",
102
- outputs: [
103
- {
104
- name: "decimals",
105
- type: "felt"
106
- }
107
- ],
108
- stateMutability: "view",
109
- type: "function"
110
- },
111
- {
112
- inputs: [
113
- {
114
- name: "account",
115
- type: "felt"
116
- }
117
- ],
118
- name: "balanceOf",
119
- outputs: [
120
- {
121
- name: "balance",
122
- type: "Uint256"
123
- }
124
- ],
125
- stateMutability: "view",
126
- type: "function"
127
- },
128
- {
129
- inputs: [
130
- {
131
- name: "owner",
132
- type: "felt"
133
- },
134
- {
135
- name: "spender",
136
- type: "felt"
137
- }
138
- ],
139
- name: "allowance",
140
- outputs: [
141
- {
142
- name: "remaining",
143
- type: "Uint256"
144
- }
145
- ],
146
- stateMutability: "view",
147
- type: "function"
148
- },
149
- {
150
- inputs: [
151
- ],
152
- name: "permittedMinter",
153
- outputs: [
154
- {
155
- name: "minter",
156
- type: "felt"
157
- }
158
- ],
159
- stateMutability: "view",
160
- type: "function"
161
- },
162
- {
163
- inputs: [
164
- ],
165
- name: "initialized",
166
- outputs: [
167
- {
168
- name: "res",
169
- type: "felt"
170
- }
171
- ],
172
- stateMutability: "view",
173
- type: "function"
174
- },
175
- {
176
- inputs: [
177
- ],
178
- name: "get_version",
179
- outputs: [
180
- {
181
- name: "version",
182
- type: "felt"
183
- }
184
- ],
185
- stateMutability: "view",
186
- type: "function"
187
- },
188
- {
189
- inputs: [
190
- ],
191
- name: "get_identity",
192
- outputs: [
193
- {
194
- name: "identity",
195
- type: "felt"
196
- }
197
- ],
198
- stateMutability: "view",
199
- type: "function"
200
- },
201
- {
202
- inputs: [
203
- {
204
- name: "init_vector_len",
205
- type: "felt"
206
- },
207
- {
208
- name: "init_vector",
209
- type: "felt*"
210
- }
211
- ],
212
- name: "initialize",
213
- outputs: [
214
- ],
215
- type: "function"
216
- },
217
- {
218
- inputs: [
219
- {
220
- name: "recipient",
221
- type: "felt"
222
- },
223
- {
224
- name: "amount",
225
- type: "Uint256"
226
- }
227
- ],
228
- name: "transfer",
229
- outputs: [
230
- {
231
- name: "success",
232
- type: "felt"
233
- }
234
- ],
235
- type: "function"
236
- },
237
- {
238
- inputs: [
239
- {
240
- name: "sender",
241
- type: "felt"
242
- },
243
- {
244
- name: "recipient",
245
- type: "felt"
246
- },
247
- {
248
- name: "amount",
249
- type: "Uint256"
250
- }
251
- ],
252
- name: "transferFrom",
253
- outputs: [
254
- {
255
- name: "success",
256
- type: "felt"
257
- }
258
- ],
259
- type: "function"
260
- },
261
- {
262
- inputs: [
263
- {
264
- name: "spender",
265
- type: "felt"
266
- },
267
- {
268
- name: "amount",
269
- type: "Uint256"
270
- }
271
- ],
272
- name: "approve",
273
- outputs: [
274
- {
275
- name: "success",
276
- type: "felt"
277
- }
278
- ],
279
- type: "function"
280
- },
281
- {
282
- inputs: [
283
- {
284
- name: "spender",
285
- type: "felt"
286
- },
287
- {
288
- name: "added_value",
289
- type: "Uint256"
290
- }
291
- ],
292
- name: "increaseAllowance",
293
- outputs: [
294
- {
295
- name: "success",
296
- type: "felt"
297
- }
298
- ],
299
- type: "function"
300
- },
301
- {
302
- inputs: [
303
- {
304
- name: "spender",
305
- type: "felt"
306
- },
307
- {
308
- name: "subtracted_value",
309
- type: "Uint256"
310
- }
311
- ],
312
- name: "decreaseAllowance",
313
- outputs: [
314
- {
315
- name: "success",
316
- type: "felt"
317
- }
318
- ],
319
- type: "function"
320
- },
321
- {
322
- inputs: [
323
- {
324
- name: "recipient",
325
- type: "felt"
326
- },
327
- {
328
- name: "amount",
329
- type: "Uint256"
330
- }
331
- ],
332
- name: "permissionedMint",
333
- outputs: [
334
- ],
335
- type: "function"
336
- },
337
- {
338
- inputs: [
339
- {
340
- name: "account",
341
- type: "felt"
342
- },
343
- {
344
- name: "amount",
345
- type: "Uint256"
346
- }
347
- ],
348
- name: "permissionedBurn",
349
- outputs: [
350
- ],
351
- type: "function"
352
- }
353
- ];
354
-
355
- export { ETH_CONTRACT_ABI as default };
@@ -1,171 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib = require('tslib');
4
- var getStarknet = require('get-starknet');
5
- var starknet = require('starknet');
6
- var constants = require('starknet/constants');
7
- var uint256 = require('starknet/dist/utils/uint256');
8
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
- var errors = require('../../errors.cjs');
10
- var logger = require('../../utils/logger.cjs');
11
- var convertors = require('../../utils/convertors.cjs');
12
- var constants$1 = require('../constants.cjs');
13
- var ethereumContractAbi = require('./ethereumContractAbi.cjs');
14
-
15
- const ACCOUNT_CHANGED_EVENT_LISTENER = 'accountsChanged';
16
- const NETWORK_CHANGED_EVENT_LISTENER = 'networkChanged';
17
- class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
18
- constructor(name, windowKey) {
19
- super();
20
- this.connectedChain = 'STARK';
21
- this.supportedChains = ['STARK'];
22
- this.name = name;
23
- this.windowKey = windowKey;
24
- }
25
- connect() {
26
- return tslib.__awaiter(this, void 0, void 0, function* () {
27
- const wallet = yield this.getWallet();
28
- try {
29
- if (wallet && !wallet.isConnected) {
30
- yield wallet.enable({ showModal: false });
31
- }
32
- }
33
- catch (err) {
34
- logger.logger.error(err);
35
- }
36
- });
37
- }
38
- fetchPublicAddress() {
39
- return tslib.__awaiter(this, void 0, void 0, function* () {
40
- const wallet = yield this.getWallet();
41
- yield this.connect();
42
- return Promise.resolve(wallet === null || wallet === void 0 ? void 0 : wallet.selectedAddress);
43
- });
44
- }
45
- getSigner() {
46
- return tslib.__awaiter(this, void 0, void 0, function* () {
47
- const wallet = yield this.getWallet();
48
- return wallet === null || wallet === void 0 ? void 0 : wallet.account;
49
- });
50
- }
51
- getWallet() {
52
- return tslib.__awaiter(this, void 0, void 0, function* () {
53
- if (!this.wallet) {
54
- const providers = yield getStarknet.getInstalledWallets();
55
- this.wallet = providers.find((provider) => provider.name === this.name);
56
- }
57
- return this.wallet;
58
- });
59
- }
60
- getWeb3Provider() {
61
- return tslib.__awaiter(this, void 0, void 0, function* () {
62
- const wallet = yield this.getWallet();
63
- return wallet === null || wallet === void 0 ? void 0 : wallet.provider;
64
- });
65
- }
66
- signMessage(messageToSign) {
67
- return tslib.__awaiter(this, void 0, void 0, function* () {
68
- const wallet = yield this.getWallet();
69
- const walletAddress = yield this.fetchPublicAddress();
70
- if (!walletAddress || !wallet) {
71
- logger.logger.error('Could not fetch wallet address for signing message');
72
- return undefined;
73
- }
74
- const { account } = wallet;
75
- const chainId = account.chainId === constants.StarknetChainId.TESTNET ? 'SN_GOERLI' : 'SN_MAIN';
76
- const encodedMessage = convertors.formatTypedDataMessage(messageToSign, chainId);
77
- const signature = yield (account === null || account === void 0 ? void 0 : account.signMessage(encodedMessage));
78
- return signature === null || signature === void 0 ? void 0 : signature.join(',');
79
- });
80
- }
81
- getBalance() {
82
- return tslib.__awaiter(this, void 0, void 0, function* () {
83
- const walletAddress = yield this.fetchPublicAddress();
84
- const provider = yield this.getWeb3Provider();
85
- if (!walletAddress || !provider) {
86
- logger.logger.error('Could not fetch wallet address for getting balance');
87
- return undefined;
88
- }
89
- const contract = new starknet.Contract(ethereumContractAbi, constants$1.ETH_STARKNET_ADDRESS, provider);
90
- try {
91
- const { balance } = yield contract.balanceOf(walletAddress);
92
- const gweiBalance = parseInt(uint256.uint256ToBN(balance).toString(10));
93
- /**
94
- * Dividing by 1e18 as the returned balance is a Gwei number.
95
- * Read more here: https://www.investopedia.com/terms/g/gwei-ethereum.asp#toc-what-is-gwei
96
- */
97
- return (gweiBalance / 1e18).toFixed(6);
98
- }
99
- catch (error) {
100
- throw new errors.DynamicError('Something went wrong');
101
- }
102
- });
103
- }
104
- endSession() {
105
- return tslib.__awaiter(this, void 0, void 0, function* () {
106
- getStarknet.disconnect({
107
- clearLastWallet: true,
108
- });
109
- });
110
- }
111
- getStarknetWindowObject() {
112
- const starknetWindowInstance = window[`starknet_${this.windowKey}`] || window['starknet'];
113
- if ((starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name) {
114
- return starknetWindowInstance;
115
- }
116
- else {
117
- return undefined;
118
- }
119
- }
120
- isInstalledOnBrowser() {
121
- var _a;
122
- const starknetWindowInstance = (_a = window[`starknet_${this.windowKey}`]) !== null && _a !== void 0 ? _a : window['starknet'];
123
- return (starknetWindowInstance === null || starknetWindowInstance === void 0 ? void 0 : starknetWindowInstance.name) === this.name;
124
- }
125
- getConnectedAccounts() {
126
- return tslib.__awaiter(this, void 0, void 0, function* () {
127
- const wallet = yield this.getWallet();
128
- return wallet ? [wallet.account.address] : [];
129
- });
130
- }
131
- setupEventListeners(listeners) {
132
- const wallet = this.getStarknetWindowObject();
133
- this.handleAccountChange = (address) => tslib.__awaiter(this, void 0, void 0, function* () {
134
- var _a, _b;
135
- if (!address) {
136
- yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
137
- return;
138
- }
139
- if (address.toString()) {
140
- yield ((_b = listeners.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(listeners, [address.toString()]));
141
- }
142
- });
143
- this.handleNetworkChange = (network) => tslib.__awaiter(this, void 0, void 0, function* () {
144
- var _c, _d;
145
- if (!network) {
146
- yield ((_c = listeners.onDisconnect) === null || _c === void 0 ? void 0 : _c.call(listeners));
147
- return;
148
- }
149
- if (network.toString()) {
150
- yield ((_d = listeners.onChainChange) === null || _d === void 0 ? void 0 : _d.call(listeners, network.toString()));
151
- }
152
- });
153
- wallet === null || wallet === void 0 ? void 0 : wallet.on(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
154
- wallet === null || wallet === void 0 ? void 0 : wallet.on(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
155
- }
156
- teardownEventListeners() {
157
- return tslib.__awaiter(this, void 0, void 0, function* () {
158
- const wallet = yield this.getWallet();
159
- if (this.handleAccountChange) {
160
- wallet === null || wallet === void 0 ? void 0 : wallet.off(ACCOUNT_CHANGED_EVENT_LISTENER, this.handleAccountChange);
161
- this.handleAccountChange = undefined;
162
- }
163
- if (this.handleNetworkChange) {
164
- wallet === null || wallet === void 0 ? void 0 : wallet.off(NETWORK_CHANGED_EVENT_LISTENER, this.handleNetworkChange);
165
- this.handleNetworkChange = undefined;
166
- }
167
- });
168
- }
169
- }
170
-
171
- module.exports = StarknetWalletConnector;
@@ -1,34 +0,0 @@
1
- import { IStarknetWindowObject } from 'get-starknet';
2
- import { AccountInterface, ProviderInterface } from 'starknet';
3
- import { Chain, WalletConnectorBase, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
4
- type AccountChangeEventHandler = (address: {
5
- toString(): string;
6
- }) => Promise<void>;
7
- type NetworkChangeEventHandler = (network: {
8
- toString(): string;
9
- }) => Promise<void>;
10
- type WalletKeys = 'braavos' | 'argentX';
11
- declare abstract class StarknetWalletConnector extends WalletConnectorBase {
12
- name: string;
13
- windowKey: WalletKeys;
14
- connectedChain: Chain;
15
- supportedChains: Chain[];
16
- wallet: IStarknetWindowObject | undefined;
17
- handleAccountChange: AccountChangeEventHandler | undefined;
18
- handleNetworkChange: NetworkChangeEventHandler | undefined;
19
- constructor(name: string, windowKey: WalletKeys);
20
- connect(): Promise<void>;
21
- fetchPublicAddress(): Promise<string | undefined>;
22
- getSigner(): Promise<AccountInterface | undefined>;
23
- getWallet(): Promise<IStarknetWindowObject | undefined>;
24
- getWeb3Provider(): Promise<ProviderInterface | undefined>;
25
- signMessage(messageToSign: string): Promise<string | undefined>;
26
- getBalance(): Promise<string | undefined>;
27
- endSession(): Promise<void>;
28
- getStarknetWindowObject(): IStarknetWindowObject | undefined;
29
- isInstalledOnBrowser(): boolean;
30
- getConnectedAccounts(): Promise<string[]>;
31
- setupEventListeners(listeners: WalletEventListeners): void;
32
- teardownEventListeners(): Promise<void>;
33
- }
34
- export default StarknetWalletConnector;