@rango-dev/wallets-core 0.0.0-experimental-936229e8-20251208

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 (351) hide show
  1. package/CHANGELOG.md +334 -0
  2. package/dist/builders/action.d.ts +22 -0
  3. package/dist/builders/action.d.ts.map +1 -0
  4. package/dist/builders/mod.d.ts +5 -0
  5. package/dist/builders/mod.d.ts.map +1 -0
  6. package/dist/builders/namespace.d.ts +47 -0
  7. package/dist/builders/namespace.d.ts.map +1 -0
  8. package/dist/builders/provider.d.ts +13 -0
  9. package/dist/builders/provider.d.ts.map +1 -0
  10. package/dist/builders/types.d.ts +21 -0
  11. package/dist/builders/types.d.ts.map +1 -0
  12. package/dist/hub/helpers.d.ts +6 -0
  13. package/dist/hub/helpers.d.ts.map +1 -0
  14. package/dist/hub/hub.d.ts +29 -0
  15. package/dist/hub/hub.d.ts.map +1 -0
  16. package/dist/hub/mod.d.ts +9 -0
  17. package/dist/hub/mod.d.ts.map +1 -0
  18. package/dist/hub/namespaces/errors.d.ts +5 -0
  19. package/dist/hub/namespaces/errors.d.ts.map +1 -0
  20. package/dist/hub/namespaces/mod.d.ts +3 -0
  21. package/dist/hub/namespaces/mod.d.ts.map +1 -0
  22. package/dist/hub/namespaces/namespace.d.ts +148 -0
  23. package/dist/hub/namespaces/namespace.d.ts.map +1 -0
  24. package/dist/hub/namespaces/namespace.test.d.ts +11 -0
  25. package/dist/hub/namespaces/namespace.test.d.ts.map +1 -0
  26. package/dist/hub/namespaces/types.d.ts +36 -0
  27. package/dist/hub/namespaces/types.d.ts.map +1 -0
  28. package/dist/hub/provider/mod.d.ts +3 -0
  29. package/dist/hub/provider/mod.d.ts.map +1 -0
  30. package/dist/hub/provider/provider.d.ts +136 -0
  31. package/dist/hub/provider/provider.d.ts.map +1 -0
  32. package/dist/hub/provider/provider.test.d.ts +2 -0
  33. package/dist/hub/provider/provider.test.d.ts.map +1 -0
  34. package/dist/hub/provider/types.d.ts +37 -0
  35. package/dist/hub/provider/types.d.ts.map +1 -0
  36. package/dist/hub/store/events.d.ts +54 -0
  37. package/dist/hub/store/events.d.ts.map +1 -0
  38. package/dist/hub/store/extend.d.ts +14 -0
  39. package/dist/hub/store/extend.d.ts.map +1 -0
  40. package/dist/hub/store/hub.d.ts +11 -0
  41. package/dist/hub/store/hub.d.ts.map +1 -0
  42. package/dist/hub/store/mod.d.ts +8 -0
  43. package/dist/hub/store/mod.d.ts.map +1 -0
  44. package/dist/hub/store/mod.js +2 -0
  45. package/dist/hub/store/mod.js.map +7 -0
  46. package/dist/hub/store/namespaces.d.ts +38 -0
  47. package/dist/hub/store/namespaces.d.ts.map +1 -0
  48. package/dist/hub/store/providers.d.ts +77 -0
  49. package/dist/hub/store/providers.d.ts.map +1 -0
  50. package/dist/hub/store/selectors.d.ts +18 -0
  51. package/dist/hub/store/selectors.d.ts.map +1 -0
  52. package/dist/hub/store/store.d.ts +14 -0
  53. package/dist/hub/store/store.d.ts.map +1 -0
  54. package/dist/hub/store/store.test.d.ts +2 -0
  55. package/dist/hub/store/store.test.d.ts.map +1 -0
  56. package/dist/legacy/helpers.d.ts +12 -0
  57. package/dist/legacy/helpers.d.ts.map +1 -0
  58. package/dist/legacy/mod.d.ts +8 -0
  59. package/dist/legacy/mod.d.ts.map +1 -0
  60. package/dist/legacy/mod.js +2 -0
  61. package/dist/legacy/mod.js.map +7 -0
  62. package/dist/legacy/persistor.d.ts +11 -0
  63. package/dist/legacy/persistor.d.ts.map +1 -0
  64. package/dist/legacy/types.d.ts +247 -0
  65. package/dist/legacy/types.d.ts.map +1 -0
  66. package/dist/legacy/utils.d.ts +8 -0
  67. package/dist/legacy/utils.d.ts.map +1 -0
  68. package/dist/legacy/wallet.d.ts +65 -0
  69. package/dist/legacy/wallet.d.ts.map +1 -0
  70. package/dist/mod.d.ts +9 -0
  71. package/dist/mod.d.ts.map +1 -0
  72. package/dist/mod.js +2 -0
  73. package/dist/mod.js.map +7 -0
  74. package/dist/namespaces/common/actions.d.ts +4 -0
  75. package/dist/namespaces/common/actions.d.ts.map +1 -0
  76. package/dist/namespaces/common/after.d.ts +4 -0
  77. package/dist/namespaces/common/after.d.ts.map +1 -0
  78. package/dist/namespaces/common/and.d.ts +6 -0
  79. package/dist/namespaces/common/and.d.ts.map +1 -0
  80. package/dist/namespaces/common/before.d.ts +4 -0
  81. package/dist/namespaces/common/before.d.ts.map +1 -0
  82. package/dist/namespaces/common/builders.d.ts +5 -0
  83. package/dist/namespaces/common/builders.d.ts.map +1 -0
  84. package/dist/namespaces/common/helpers.d.ts +2 -0
  85. package/dist/namespaces/common/helpers.d.ts.map +1 -0
  86. package/dist/namespaces/common/hooks/changeAccountSubscriber.d.ts +90 -0
  87. package/dist/namespaces/common/hooks/changeAccountSubscriber.d.ts.map +1 -0
  88. package/dist/namespaces/common/hooks/changeAccountSubscriber.test.d.ts +2 -0
  89. package/dist/namespaces/common/hooks/changeAccountSubscriber.test.d.ts.map +1 -0
  90. package/dist/namespaces/common/mod.d.ts +11 -0
  91. package/dist/namespaces/common/mod.d.ts.map +1 -0
  92. package/dist/namespaces/common/mod.js +2 -0
  93. package/dist/namespaces/common/mod.js.map +7 -0
  94. package/dist/namespaces/common/or.d.ts +13 -0
  95. package/dist/namespaces/common/or.d.ts.map +1 -0
  96. package/dist/namespaces/common/types.d.ts +11 -0
  97. package/dist/namespaces/common/types.d.ts.map +1 -0
  98. package/dist/namespaces/common/utils.d.ts +10 -0
  99. package/dist/namespaces/common/utils.d.ts.map +1 -0
  100. package/dist/namespaces/cosmos/actions.d.ts +2 -0
  101. package/dist/namespaces/cosmos/actions.d.ts.map +1 -0
  102. package/dist/namespaces/cosmos/after.d.ts +2 -0
  103. package/dist/namespaces/cosmos/after.d.ts.map +1 -0
  104. package/dist/namespaces/cosmos/and.d.ts +3 -0
  105. package/dist/namespaces/cosmos/and.d.ts.map +1 -0
  106. package/dist/namespaces/cosmos/before.d.ts +2 -0
  107. package/dist/namespaces/cosmos/before.d.ts.map +1 -0
  108. package/dist/namespaces/cosmos/builders.d.ts +4 -0
  109. package/dist/namespaces/cosmos/builders.d.ts.map +1 -0
  110. package/dist/namespaces/cosmos/constants.d.ts +2 -0
  111. package/dist/namespaces/cosmos/constants.d.ts.map +1 -0
  112. package/dist/namespaces/cosmos/mod.d.ts +9 -0
  113. package/dist/namespaces/cosmos/mod.d.ts.map +1 -0
  114. package/dist/namespaces/cosmos/mod.js +2 -0
  115. package/dist/namespaces/cosmos/mod.js.map +7 -0
  116. package/dist/namespaces/cosmos/types.d.ts +19 -0
  117. package/dist/namespaces/cosmos/types.d.ts.map +1 -0
  118. package/dist/namespaces/cosmos/utils.d.ts +3 -0
  119. package/dist/namespaces/cosmos/utils.d.ts.map +1 -0
  120. package/dist/namespaces/evm/actions.d.ts +10 -0
  121. package/dist/namespaces/evm/actions.d.ts.map +1 -0
  122. package/dist/namespaces/evm/after.d.ts +2 -0
  123. package/dist/namespaces/evm/after.d.ts.map +1 -0
  124. package/dist/namespaces/evm/and.d.ts +3 -0
  125. package/dist/namespaces/evm/and.d.ts.map +1 -0
  126. package/dist/namespaces/evm/before.d.ts +2 -0
  127. package/dist/namespaces/evm/before.d.ts.map +1 -0
  128. package/dist/namespaces/evm/builders.d.ts +9 -0
  129. package/dist/namespaces/evm/builders.d.ts.map +1 -0
  130. package/dist/namespaces/evm/constants.d.ts +3 -0
  131. package/dist/namespaces/evm/constants.d.ts.map +1 -0
  132. package/dist/namespaces/evm/eip1193.d.ts +1229 -0
  133. package/dist/namespaces/evm/eip1193.d.ts.map +1 -0
  134. package/dist/namespaces/evm/hooks.d.ts +5 -0
  135. package/dist/namespaces/evm/hooks.d.ts.map +1 -0
  136. package/dist/namespaces/evm/mod.d.ts +10 -0
  137. package/dist/namespaces/evm/mod.d.ts.map +1 -0
  138. package/dist/namespaces/evm/mod.js +2 -0
  139. package/dist/namespaces/evm/mod.js.map +7 -0
  140. package/dist/namespaces/evm/types.d.ts +23 -0
  141. package/dist/namespaces/evm/types.d.ts.map +1 -0
  142. package/dist/namespaces/evm/utils.d.ts +13 -0
  143. package/dist/namespaces/evm/utils.d.ts.map +1 -0
  144. package/dist/namespaces/solana/actions.d.ts +7 -0
  145. package/dist/namespaces/solana/actions.d.ts.map +1 -0
  146. package/dist/namespaces/solana/after.d.ts +2 -0
  147. package/dist/namespaces/solana/after.d.ts.map +1 -0
  148. package/dist/namespaces/solana/and.d.ts +3 -0
  149. package/dist/namespaces/solana/and.d.ts.map +1 -0
  150. package/dist/namespaces/solana/before.d.ts +2 -0
  151. package/dist/namespaces/solana/before.d.ts.map +1 -0
  152. package/dist/namespaces/solana/builders.d.ts +6 -0
  153. package/dist/namespaces/solana/builders.d.ts.map +1 -0
  154. package/dist/namespaces/solana/constants.d.ts +3 -0
  155. package/dist/namespaces/solana/constants.d.ts.map +1 -0
  156. package/dist/namespaces/solana/hooks.d.ts +4 -0
  157. package/dist/namespaces/solana/hooks.d.ts.map +1 -0
  158. package/dist/namespaces/solana/mod.d.ts +10 -0
  159. package/dist/namespaces/solana/mod.d.ts.map +1 -0
  160. package/dist/namespaces/solana/mod.js +2 -0
  161. package/dist/namespaces/solana/mod.js.map +7 -0
  162. package/dist/namespaces/solana/types.d.ts +11 -0
  163. package/dist/namespaces/solana/types.d.ts.map +1 -0
  164. package/dist/namespaces/solana/utils.d.ts +8 -0
  165. package/dist/namespaces/solana/utils.d.ts.map +1 -0
  166. package/dist/namespaces/sui/actions.d.ts +8 -0
  167. package/dist/namespaces/sui/actions.d.ts.map +1 -0
  168. package/dist/namespaces/sui/builders.d.ts +14 -0
  169. package/dist/namespaces/sui/builders.d.ts.map +1 -0
  170. package/dist/namespaces/sui/constants.d.ts +3 -0
  171. package/dist/namespaces/sui/constants.d.ts.map +1 -0
  172. package/dist/namespaces/sui/hooks.d.ts +4 -0
  173. package/dist/namespaces/sui/hooks.d.ts.map +1 -0
  174. package/dist/namespaces/sui/mod.d.ts +7 -0
  175. package/dist/namespaces/sui/mod.d.ts.map +1 -0
  176. package/dist/namespaces/sui/mod.js +2 -0
  177. package/dist/namespaces/sui/mod.js.map +7 -0
  178. package/dist/namespaces/sui/types.d.ts +12 -0
  179. package/dist/namespaces/sui/types.d.ts.map +1 -0
  180. package/dist/namespaces/sui/utils.d.ts +15 -0
  181. package/dist/namespaces/sui/utils.d.ts.map +1 -0
  182. package/dist/namespaces/tron/actions.d.ts +2 -0
  183. package/dist/namespaces/tron/actions.d.ts.map +1 -0
  184. package/dist/namespaces/tron/after.d.ts +2 -0
  185. package/dist/namespaces/tron/after.d.ts.map +1 -0
  186. package/dist/namespaces/tron/and.d.ts +3 -0
  187. package/dist/namespaces/tron/and.d.ts.map +1 -0
  188. package/dist/namespaces/tron/before.d.ts +2 -0
  189. package/dist/namespaces/tron/before.d.ts.map +1 -0
  190. package/dist/namespaces/tron/builders.d.ts +5 -0
  191. package/dist/namespaces/tron/builders.d.ts.map +1 -0
  192. package/dist/namespaces/tron/constants.d.ts +3 -0
  193. package/dist/namespaces/tron/constants.d.ts.map +1 -0
  194. package/dist/namespaces/tron/mod.d.ts +9 -0
  195. package/dist/namespaces/tron/mod.d.ts.map +1 -0
  196. package/dist/namespaces/tron/mod.js +2 -0
  197. package/dist/namespaces/tron/mod.js.map +7 -0
  198. package/dist/namespaces/tron/types.d.ts +8 -0
  199. package/dist/namespaces/tron/types.d.ts.map +1 -0
  200. package/dist/namespaces/tron/utils.d.ts +2 -0
  201. package/dist/namespaces/tron/utils.d.ts.map +1 -0
  202. package/dist/namespaces/utxo/actions.d.ts +2 -0
  203. package/dist/namespaces/utxo/actions.d.ts.map +1 -0
  204. package/dist/namespaces/utxo/after.d.ts +2 -0
  205. package/dist/namespaces/utxo/after.d.ts.map +1 -0
  206. package/dist/namespaces/utxo/and.d.ts +3 -0
  207. package/dist/namespaces/utxo/and.d.ts.map +1 -0
  208. package/dist/namespaces/utxo/before.d.ts +2 -0
  209. package/dist/namespaces/utxo/before.d.ts.map +1 -0
  210. package/dist/namespaces/utxo/builders.d.ts +4 -0
  211. package/dist/namespaces/utxo/builders.d.ts.map +1 -0
  212. package/dist/namespaces/utxo/constants.d.ts +3 -0
  213. package/dist/namespaces/utxo/constants.d.ts.map +1 -0
  214. package/dist/namespaces/utxo/mod.d.ts +9 -0
  215. package/dist/namespaces/utxo/mod.d.ts.map +1 -0
  216. package/dist/namespaces/utxo/mod.js +2 -0
  217. package/dist/namespaces/utxo/mod.js.map +7 -0
  218. package/dist/namespaces/utxo/types.d.ts +8 -0
  219. package/dist/namespaces/utxo/types.d.ts.map +1 -0
  220. package/dist/namespaces/utxo/utils.d.ts +2 -0
  221. package/dist/namespaces/utxo/utils.d.ts.map +1 -0
  222. package/dist/test-utils/fixtures.d.ts +4 -0
  223. package/dist/test-utils/fixtures.d.ts.map +1 -0
  224. package/dist/types/accounts.d.ts +11 -0
  225. package/dist/types/accounts.d.ts.map +1 -0
  226. package/dist/types/actions.d.ts +5 -0
  227. package/dist/types/actions.d.ts.map +1 -0
  228. package/dist/types/mod.d.ts +2 -0
  229. package/dist/types/mod.d.ts.map +1 -0
  230. package/dist/types/utils.d.ts +7 -0
  231. package/dist/types/utils.d.ts.map +1 -0
  232. package/dist/utils/mod.d.ts +4 -0
  233. package/dist/utils/mod.d.ts.map +1 -0
  234. package/dist/utils/mod.js +2 -0
  235. package/dist/utils/mod.js.map +7 -0
  236. package/dist/utils/versions.d.ts +21 -0
  237. package/dist/utils/versions.d.ts.map +1 -0
  238. package/dist/utils/versions.test.d.ts +2 -0
  239. package/dist/utils/versions.test.d.ts.map +1 -0
  240. package/dist/wallets-core.build.json +1 -0
  241. package/legacy/package.json +8 -0
  242. package/package.json +84 -0
  243. package/readme.md +4 -0
  244. package/src/builders/action.ts +86 -0
  245. package/src/builders/mod.ts +5 -0
  246. package/src/builders/namespace.ts +258 -0
  247. package/src/builders/provider.ts +61 -0
  248. package/src/builders/types.ts +29 -0
  249. package/src/hub/helpers.ts +11 -0
  250. package/src/hub/hub.ts +128 -0
  251. package/src/hub/mod.ts +18 -0
  252. package/src/hub/namespaces/errors.ts +11 -0
  253. package/src/hub/namespaces/mod.ts +10 -0
  254. package/src/hub/namespaces/namespace.test.ts +443 -0
  255. package/src/hub/namespaces/namespace.ts +470 -0
  256. package/src/hub/namespaces/types.ts +58 -0
  257. package/src/hub/provider/mod.ts +10 -0
  258. package/src/hub/provider/provider.test.ts +232 -0
  259. package/src/hub/provider/provider.ts +335 -0
  260. package/src/hub/provider/types.ts +50 -0
  261. package/src/hub/store/events.ts +89 -0
  262. package/src/hub/store/extend.ts +125 -0
  263. package/src/hub/store/hub.ts +18 -0
  264. package/src/hub/store/mod.ts +25 -0
  265. package/src/hub/store/namespaces.ts +177 -0
  266. package/src/hub/store/providers.ts +169 -0
  267. package/src/hub/store/selectors.ts +59 -0
  268. package/src/hub/store/store.test.ts +50 -0
  269. package/src/hub/store/store.ts +30 -0
  270. package/src/legacy/helpers.ts +75 -0
  271. package/src/legacy/mod.ts +44 -0
  272. package/src/legacy/persistor.ts +19 -0
  273. package/src/legacy/types.ts +291 -0
  274. package/src/legacy/utils.ts +20 -0
  275. package/src/legacy/wallet.ts +552 -0
  276. package/src/mod.ts +44 -0
  277. package/src/namespaces/common/actions.ts +12 -0
  278. package/src/namespaces/common/after.ts +8 -0
  279. package/src/namespaces/common/and.ts +42 -0
  280. package/src/namespaces/common/before.ts +9 -0
  281. package/src/namespaces/common/builders.ts +14 -0
  282. package/src/namespaces/common/helpers.ts +10 -0
  283. package/src/namespaces/common/hooks/changeAccountSubscriber.test.ts +173 -0
  284. package/src/namespaces/common/hooks/changeAccountSubscriber.ts +236 -0
  285. package/src/namespaces/common/mod.ts +23 -0
  286. package/src/namespaces/common/or.ts +17 -0
  287. package/src/namespaces/common/types.ts +25 -0
  288. package/src/namespaces/common/utils.ts +43 -0
  289. package/src/namespaces/cosmos/actions.ts +3 -0
  290. package/src/namespaces/cosmos/after.ts +3 -0
  291. package/src/namespaces/cosmos/and.ts +5 -0
  292. package/src/namespaces/cosmos/before.ts +3 -0
  293. package/src/namespaces/cosmos/builders.ts +15 -0
  294. package/src/namespaces/cosmos/constants.ts +1 -0
  295. package/src/namespaces/cosmos/mod.ts +9 -0
  296. package/src/namespaces/cosmos/types.ts +26 -0
  297. package/src/namespaces/cosmos/utils.ts +21 -0
  298. package/src/namespaces/evm/actions.ts +119 -0
  299. package/src/namespaces/evm/after.ts +3 -0
  300. package/src/namespaces/evm/and.ts +5 -0
  301. package/src/namespaces/evm/before.ts +3 -0
  302. package/src/namespaces/evm/builders.ts +52 -0
  303. package/src/namespaces/evm/constants.ts +2 -0
  304. package/src/namespaces/evm/eip1193.ts +1415 -0
  305. package/src/namespaces/evm/hooks.ts +43 -0
  306. package/src/namespaces/evm/mod.ts +10 -0
  307. package/src/namespaces/evm/types.ts +33 -0
  308. package/src/namespaces/evm/utils.ts +106 -0
  309. package/src/namespaces/solana/actions.ts +44 -0
  310. package/src/namespaces/solana/after.ts +3 -0
  311. package/src/namespaces/solana/and.ts +5 -0
  312. package/src/namespaces/solana/before.ts +3 -0
  313. package/src/namespaces/solana/builders.ts +40 -0
  314. package/src/namespaces/solana/constants.ts +2 -0
  315. package/src/namespaces/solana/hooks.ts +10 -0
  316. package/src/namespaces/solana/mod.ts +10 -0
  317. package/src/namespaces/solana/types.ts +26 -0
  318. package/src/namespaces/solana/utils.ts +36 -0
  319. package/src/namespaces/sui/actions.ts +27 -0
  320. package/src/namespaces/sui/builders.ts +77 -0
  321. package/src/namespaces/sui/constants.ts +8 -0
  322. package/src/namespaces/sui/hooks.ts +10 -0
  323. package/src/namespaces/sui/mod.ts +8 -0
  324. package/src/namespaces/sui/types.ts +26 -0
  325. package/src/namespaces/sui/utils.ts +56 -0
  326. package/src/namespaces/tron/actions.ts +3 -0
  327. package/src/namespaces/tron/after.ts +3 -0
  328. package/src/namespaces/tron/and.ts +5 -0
  329. package/src/namespaces/tron/before.ts +3 -0
  330. package/src/namespaces/tron/builders.ts +15 -0
  331. package/src/namespaces/tron/constants.ts +8 -0
  332. package/src/namespaces/tron/mod.ts +8 -0
  333. package/src/namespaces/tron/types.ts +15 -0
  334. package/src/namespaces/tron/utils.ts +18 -0
  335. package/src/namespaces/utxo/actions.ts +3 -0
  336. package/src/namespaces/utxo/after.ts +3 -0
  337. package/src/namespaces/utxo/and.ts +5 -0
  338. package/src/namespaces/utxo/before.ts +3 -0
  339. package/src/namespaces/utxo/builders.ts +12 -0
  340. package/src/namespaces/utxo/constants.ts +2 -0
  341. package/src/namespaces/utxo/mod.ts +8 -0
  342. package/src/namespaces/utxo/types.ts +15 -0
  343. package/src/namespaces/utxo/utils.ts +18 -0
  344. package/src/test-utils/fixtures.ts +13 -0
  345. package/src/types/accounts.ts +12 -0
  346. package/src/types/actions.ts +11 -0
  347. package/src/types/mod.ts +1 -0
  348. package/src/types/utils.ts +7 -0
  349. package/src/utils/mod.ts +8 -0
  350. package/src/utils/versions.test.ts +22 -0
  351. package/src/utils/versions.ts +62 -0
@@ -0,0 +1,148 @@
1
+ import type { Actions, Context, GetState, RegisteredActions, SetState } from './types.js';
2
+ import type { AndFunction, AnyFunction, FunctionWithContext } from '../../types/actions.js';
3
+ import type { NamespaceConfig, Store } from '../store/mod.js';
4
+ type Params = any[];
5
+ /**
6
+ *
7
+ * A Namespace is a unit of wallets where usually handles connecting, signing, accounts, ...
8
+ * It will be injected by wallet in its object, for example, `window.phantom.ethereum` or `window.phantom.solana`
9
+ * Each namespace (like solana) has its own functionality which is not shared between all the blockchains.
10
+ * For example in EVM namespaces, you can have different networks (e.g. Ethereum,Polygon, ...) and there are specific flows to handle connecting to them or add a network and etc.
11
+ * But Solana doesn't have this concept and you will directly always connect to solana itself.
12
+ * This is true for signing a transaction, getting information about blockchain and more.
13
+ * So by creating a namespace for each of these, we can define a custom namespace based on blockchain's properties.
14
+ *
15
+ */
16
+ declare class Namespace<T extends Actions<T>> {
17
+ #private;
18
+ /** it will be used for `store` and accessing to store by its id mainly. */
19
+ readonly namespaceId: string;
20
+ /** it will be used for `store` and accessing to store by its id mainly. */
21
+ readonly providerId: string;
22
+ constructor(id: string, providerId: string, options: {
23
+ store?: Store;
24
+ configs?: NamespaceConfig;
25
+ actions: RegisteredActions<T>;
26
+ });
27
+ /**
28
+ * This is an special action that will be called **only once**.
29
+ * We don't call this in `constructor` and developer should call this manually. we only ensure it will be called once.
30
+ *
31
+ * ```ts
32
+ * const myInit = () => { whatever; }
33
+ * const actions = new Map();
34
+ * actions.set("init", myInit)
35
+ * const ns = new Namespace(..., {actions});
36
+ *
37
+ * // Will run `myInit`
38
+ * ns.init()
39
+ *
40
+ * // Will not run `myInit` anymore.
41
+ * ns.init()
42
+ * ns.init()
43
+ * ```
44
+ */
45
+ init(): void;
46
+ /**
47
+ * Reading states from store and also update them.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const ns = new Namespace(...);
52
+ * const [getState, setState] = ns.state();
53
+ * ```
54
+ */
55
+ state(): [GetState, SetState];
56
+ /**
57
+ * For keeping state, we need a store. all the states will be write to/read from store.
58
+ *
59
+ * Note: Store can be setup on constructor as well.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const myStore = createStore();
64
+ * const ns = new Namespace(...);
65
+ * ns.store(myStore);
66
+ * ```
67
+ */
68
+ store(store: Store): this;
69
+ /**
70
+ * It's a boolean operator to run a sync function if action ran successfully.
71
+ * For example, if we have a `connect` action, we can add function to be run after `connect` if it ran successfully.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const ns = new Namespace(..);
76
+ *
77
+ * ns.and_then('connect', (context) => {
78
+ * ...
79
+ * });
80
+ * ```
81
+ *
82
+ */
83
+ and_then<K extends keyof T>(actionName: K, operatorFn: FunctionWithContext<AndFunction<T, K>, Context>): this;
84
+ /**
85
+ * It's a boolean operator to run a function to handle when an action fails.
86
+ * For example, if we have a `connect` action, we can add function to be run when `connect` fails (throw an error).
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const ns = new Namespace(..);
91
+ *
92
+ * ns.or_else('connect', (context, error) => {
93
+ * ...
94
+ * });
95
+ * ```
96
+ */
97
+ or_else<K extends keyof T>(actionName: K, operatorFn: FunctionWithContext<AnyFunction, Context>): this;
98
+ /**
99
+ * Running a function after a specific action
100
+ *
101
+ * Note: the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const ns = new Namespace(...);
106
+ *
107
+ * ns.after("connect", (context) => {});
108
+ * ```
109
+ */
110
+ after<K extends keyof T, C = unknown>(actionName: K, hook: FunctionWithContext<AnyFunction, C>, options?: {
111
+ context?: C;
112
+ }): this;
113
+ /**
114
+ * Running a function before a specific action
115
+ *
116
+ * Note: the context can be set from outside as well. this is useful for Provider to set its context instead of using namespace context.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const ns = new Namespace(...);
121
+ *
122
+ * ns.before("connect", (context) => {});
123
+ * ```
124
+ */
125
+ before<K extends keyof T, C = unknown>(actionName: K, hook: FunctionWithContext<AnyFunction, C>, options?: {
126
+ context?: C;
127
+ }): this;
128
+ has<K extends keyof T>(actionName: K): boolean;
129
+ /**
130
+ *
131
+ * Registered actions will be called using `run`. it will run an action and all the operators or hooks that assigned.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const actions = new Map();
136
+ * actions.set('connect', connectAction);
137
+ *
138
+ * const ns = new Namespace(NAMESPACE, PROVIDER_ID, {
139
+ * actions: actions,
140
+ * });
141
+ *
142
+ * ns.run("action");
143
+ * ```
144
+ */
145
+ run<K extends keyof T>(actionName: K, ...args: Params): unknown | Promise<unknown>;
146
+ }
147
+ export { Namespace };
148
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/hub/namespaces/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EAGR,iBAAiB,EACjB,QAAQ,EAET,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,WAAW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mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,EACzC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,CAAA;KAAE,GACxB,IAAI;IAaP;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,EAC1C,UAAU,EAAE,CAAC,EACb,IAAI,EAAE,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,EACzC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,CAAA;KAAE,GACxB,IAAI;IAeA,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,OAAO;IAGrD;;;;;;;;;;;;;;;OAeG;IACI,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAC1B,UAAU,EAAE,CAAC,EACb,GAAG,IAAI,EAAE,MAAM,GACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAqK9B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ interface CustomMatchers<R = unknown> {
2
+ toThrowErrorWithCause: (expectedError: unknown, expectedCause: unknown) => R;
3
+ }
4
+ declare module 'vitest' {
5
+ interface Assertion<T = any> extends CustomMatchers<T> {
6
+ }
7
+ interface AsymmetricMatchersContaining extends CustomMatchers {
8
+ }
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=namespace.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.test.d.ts","sourceRoot":"","sources":["../../../src/hub/namespaces/namespace.test.ts"],"names":[],"mappings":"AAOA,UAAU,cAAc,CAAC,CAAC,GAAG,OAAO;IAClC,qBAAqB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,KAAK,CAAC,CAAC;CAC9E;AAED,OAAO,QAAQ,QAAQ,CAAC;IAEtB,UAAU,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;KAAG;IAEzD,UAAU,4BAA6B,SAAQ,cAAc;KAAG;CACjE"}
@@ -0,0 +1,36 @@
1
+ import type { AnyFunction, FunctionWithContext } from '../../types/actions.js';
2
+ import type { NamespaceData } from '../store/mod.js';
3
+ type ActionName<K> = K | Omit<K, string>;
4
+ type Args = any[];
5
+ type ActionResult = any;
6
+ export type Subscriber<C extends Actions<C>> = (context: Context<C>, ...args: Args) => void;
7
+ export type SubscriberCleanUp<C extends Actions<C>> = (context: Context<C>, ...args: Args) => void;
8
+ export type CanEagerConnect<C extends Actions<C>> = (context: Context<C>, ...args: Args) => void;
9
+ export type State = NamespaceData;
10
+ export type SetState = <K extends keyof State>(name: K, value: State[K]) => void;
11
+ export type GetState = {
12
+ (): State;
13
+ <K extends keyof State>(name: K): State[K];
14
+ };
15
+ export type RegisteredActions<T extends Actions<T>> = Map<ActionName<keyof T>, FunctionWithContext<T[keyof T], Context<T>>>;
16
+ export type AndUseActions<T> = Map<keyof T, AnyFunction>;
17
+ export type Operators<T> = Map<keyof T, AnyFunction[]>;
18
+ export type HooksWithOptions<T> = Map<keyof T, {
19
+ hook: AnyFunction;
20
+ options?: {
21
+ context?: unknown;
22
+ };
23
+ }[]>;
24
+ export type Context<T extends Actions<T> = object> = {
25
+ state: () => [GetState, SetState];
26
+ action: (name: keyof T, ...args: Args) => ActionResult;
27
+ };
28
+ /**
29
+ * This actually define what kind of action will be implemented in namespaces.
30
+ * For example evm namespace will have .connect(chain: string) and .switchNetwork
31
+ * But solana namespace only have: `.connect()`.
32
+ * This actions will be passed to this generic.
33
+ */
34
+ export type Actions<T> = Record<keyof T, AnyFunction>;
35
+ export {};
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hub/namespaces/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAw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AC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAC5C,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;AACzD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;AACvD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,GAAG,CACnC,MAAM,CAAC,EACP;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,EAAE,CACJ,CAAC;AACF,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IACnD,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC;CACxD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { ExtendableInternalActions, CommonNamespaces, CommonNamespaceKeys, State, Context, ProviderBuilderOptions, } from './types.js';
2
+ export { Provider } from './provider.js';
3
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/hub/provider/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,136 @@
1
+ import type { CommonNamespaces, Context, ExtendableInternalActions, GetState, RegisteredNamespaces, SetState } from './types.js';
2
+ import type { FindProxiedNamespace } from '../../builders/mod.js';
3
+ import type { AnyFunction, FunctionWithContext } from '../../types/actions.js';
4
+ import type { ProviderConfig, ProviderInfo, Store } from '../store/mod.js';
5
+ export declare class Provider {
6
+ #private;
7
+ readonly id: string;
8
+ readonly version = "1.0";
9
+ constructor(id: string, namespaces: RegisteredNamespaces<keyof CommonNamespaces, CommonNamespaces>, configs: ProviderConfig, options?: {
10
+ /**
11
+ * There are some cases we need to have a behavior like initializing a provider which will be run when we are creating an instance.
12
+ * These internal steps and behaviors will be useful for library user to extend the behavior by running a specific code.
13
+ */
14
+ extendInternalActions?: ExtendableInternalActions;
15
+ store?: Store;
16
+ });
17
+ /**
18
+ * This is an special callback that will be called **only once**.
19
+ * We don't call this in `constructor` and developer should call this manually. we only ensure it will be called once.
20
+ *
21
+ * ```ts
22
+ * const myInit = () => { whatever; } *
23
+ * const provider = new Provider(..., {extendInternalActions: {init: myInit} });
24
+ *
25
+ * // Will run `myInit`
26
+ * provider.init()
27
+ *
28
+ * // Will not run `myInit` anymore.
29
+ * provider.init()
30
+ * provider.init()
31
+ * ```
32
+ */
33
+ init(): void;
34
+ /**
35
+ * Getting state of a provider
36
+ *
37
+ * **Note:**
38
+ * Each namespace has it's own state as well, in Legacy we didn't have this separation and all of them was accessible through Provider itself
39
+ * To be compatible with legacy, `getState` has a logic to guess the final state to produce same state as legacy.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const provider = new Provider(...);
44
+ * const [getState, setState] = provider.state();
45
+ *
46
+ * getState('installed');
47
+ * // or
48
+ * getState().installed;
49
+ * ```
50
+ *
51
+ */
52
+ state(): [GetState, SetState];
53
+ /**
54
+ * For keeping state, we need a store. all the states will be write to/read from store.
55
+ *
56
+ * **Note: When you are setting an store for provider, it will be set for its namespaces automatically as well**
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const myStore = createStore();
61
+ * const provider = new Provider(...);
62
+ * provider.store(myStore); // or it can be passed to Provider constructor;
63
+ * ```
64
+ */
65
+ store(store: Store): this;
66
+ /**
67
+ * Getting information about a provider which has been set on constructing Provider.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const walletInfo = {name: "Garbage wallet", ...}
72
+ * const provider = new Provider(..., {info: walletInfo});
73
+ *
74
+ * provider.info();
75
+ * ```
76
+ */
77
+ info(): ProviderInfo | undefined;
78
+ /**
79
+ * A list of registered _proxied_ namespaces.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const provider = new Provider(...);
84
+ * const allNamespaces = provider.getAll();
85
+ * ```
86
+ */
87
+ getAll(): RegisteredNamespaces<keyof CommonNamespaces, CommonNamespaces>;
88
+ /**
89
+ * Get a registered namespace in provider by its **namespace key**.
90
+ *
91
+ * Note: difference between namespace key and namespace id is the first one is setting from a predefined list the second one can be anything and will be chosen by library's user.
92
+ *
93
+ * @param {string} id - evm, solana, cosmos, ... (CommonActions)
94
+ */
95
+ get<K extends keyof CommonNamespaces>(id: K): FindProxiedNamespace<K, CommonNamespaces> | undefined;
96
+ /**
97
+ *
98
+ * Get a registered namespace by its **namespaceId**.
99
+ *
100
+ * Note: difference between namespace key and namespace id is the first one is setting from a predefined list the second one can be anything and will be chosen by library's user.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const provider = new Provider(...);
105
+ * provider.findByNamespace("whatever-id-i-set-for-namespace")
106
+ * ```
107
+ */
108
+ findByNamespace<K extends keyof CommonNamespaces>(namespaceLookingFor: K | string): FindProxiedNamespace<K, CommonNamespaces> | undefined;
109
+ /**
110
+ * Running a hook function _after_ a specific action for **all registered namespaces**.
111
+ *
112
+ * **Note:** the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const provider = new Provider(...);
117
+ *
118
+ * provider.after("connect", (context) => {});
119
+ * ```
120
+ */
121
+ before(actionName: string, hookFn: FunctionWithContext<AnyFunction, Context>): this;
122
+ /**
123
+ * Running a hook function _before_ a specific action for **all registered namespaces**.
124
+ *
125
+ * **Note:** the context can be set from outside as well. this is useful for Provider to set its context instead of namespace context.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * const provider = new Provider(...);
130
+ *
131
+ * provider.after("connect", (context) => {});
132
+ * ```
133
+ */
134
+ after(actionName: string, hookFn: FunctionWithContext<AnyFunction, Context>): this;
135
+ }
136
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/hub/provider/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,OAAO,EACP,yBAAyB,EACzB,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EAET,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI3E,qBAAa,QAAQ;;IACnB,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,OAAO,SAAW;gBAShC,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,oBAAoB,CAAC,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,EAC1E,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE;QACR;;;WAGG;QACH,qBAAqB,CAAC,EAAE,yBAAyB,CAAC;QAClD,KAAK,CAAC,EAAE,KAAK,CAAC;KACf;IAkBH;;;;;;;;;;;;;;;OAeG;IACI,IAAI,IAAI,IAAI;IAanB;;;;;;;;;;;;;;;;;OAiBG;IACI,KAAK,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IA+CpC;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAWhC;;;;;;;;;;OAUG;IACI,IAAI,IAAI,YAAY,GAAG,SAAS;IAUvC;;;;;;;;OAQG;IACI,MAAM,IAAI,oBAAoB,CACnC,MAAM,gBAAgB,EACtB,gBAAgB,CACjB;IAID;;;;;;OAMG;IACI,GAAG,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACzC,EAAE,EAAE,CAAC,GACJ,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,SAAS;IAMxD;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACrD,mBAAmB,EAAE,CAAC,GAAG,MAAM,GAC9B,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,SAAS;IAaxD;;;;;;;;;;;OAWG;IACI,MAAM,CACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,GAChD,IAAI;IAKP;;;;;;;;;;;OAWG;IACI,KAAK,CACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,GAChD,IAAI;CAiDR"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=provider.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.test.d.ts","sourceRoot":"","sources":["../../../src/hub/provider/provider.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import type { FindProxiedNamespace } from '../../builders/mod.js';
2
+ import type { Store } from '../../hub/mod.js';
3
+ import type { LegacyState } from '../../legacy/mod.js';
4
+ import type { CosmosActions } from '../../namespaces/cosmos/mod.js';
5
+ import type { EvmActions } from '../../namespaces/evm/mod.js';
6
+ import type { SolanaActions } from '../../namespaces/solana/mod.js';
7
+ import type { SuiActions } from '../../namespaces/sui/mod.js';
8
+ import type { TronActions } from '../../namespaces/tron/types.js';
9
+ import type { UtxoActions } from '../../namespaces/utxo/mod.js';
10
+ import type { AnyFunction, FunctionWithContext } from '../../types/actions.js';
11
+ import type { Prettify } from '../../types/utils.js';
12
+ export type Context = {
13
+ state: () => [GetState, SetState];
14
+ };
15
+ export type State = Omit<LegacyState, 'reachable' | 'accounts' | 'network' | 'derivationPath'>;
16
+ export type SetState = <K extends keyof Pick<State, 'installed'>>(name: K, value: State[K]) => void;
17
+ export type GetState = {
18
+ (): State;
19
+ <K extends keyof State>(name: K): State[K];
20
+ };
21
+ export interface CommonNamespaces {
22
+ evm: EvmActions;
23
+ solana: SolanaActions;
24
+ cosmos: CosmosActions;
25
+ sui: SuiActions;
26
+ utxo: UtxoActions;
27
+ tron: TronActions;
28
+ }
29
+ export type CommonNamespaceKeys = Prettify<keyof CommonNamespaces>;
30
+ export interface ExtendableInternalActions {
31
+ init?: FunctionWithContext<AnyFunction, Context>;
32
+ }
33
+ export type RegisteredNamespaces<K extends keyof T, T> = Map<K, FindProxiedNamespace<K, T>>;
34
+ export type ProviderBuilderOptions = {
35
+ store?: Store;
36
+ };
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hub/provider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,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AAE,CAAC,CAAC,CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
@@ -0,0 +1,54 @@
1
+ export type NamespaceDisconnectedEvent = {
2
+ type: 'namespace_disconnected';
3
+ provider: string;
4
+ namespace: string;
5
+ };
6
+ export type NamespaceConnectedEvent = {
7
+ type: 'namespace_connected';
8
+ provider: string;
9
+ namespace: string;
10
+ accounts: string[];
11
+ };
12
+ export type NamespaceSwitchedAccountEvent = {
13
+ type: 'namespace_account_switched';
14
+ provider: string;
15
+ namespace: string;
16
+ accounts: string[];
17
+ previousAccounts: string[];
18
+ };
19
+ export type NamespaceSwitchedNetworkEvent = {
20
+ type: 'namespace_network_switched';
21
+ provider: string;
22
+ namespace: string;
23
+ network: string;
24
+ previousNetwork: string | null;
25
+ };
26
+ export type ProviderDetectedEvent = {
27
+ type: 'provider_detected';
28
+ provider: string;
29
+ };
30
+ export type ProviderConnectingEvent = {
31
+ type: 'provider_connecting';
32
+ provider: string;
33
+ value: boolean;
34
+ };
35
+ export type ProviderConnectedEvent = {
36
+ type: 'provider_connected';
37
+ provider: string;
38
+ };
39
+ export type ProviderDisconnectedEvent = {
40
+ type: 'provider_disconnected';
41
+ provider: string;
42
+ };
43
+ export type Event = NamespaceDisconnectedEvent | NamespaceConnectedEvent | NamespaceSwitchedAccountEvent | NamespaceSwitchedNetworkEvent | ProviderDetectedEvent | ProviderConnectingEvent | ProviderConnectedEvent | ProviderDisconnectedEvent;
44
+ /**
45
+ *
46
+ * Keeping an array of Event and when iterates over its values, it will be removed (consume) from the array.
47
+ *
48
+ */
49
+ export declare class ConsumableEvents {
50
+ #private;
51
+ push(val: Event): void;
52
+ [Symbol.iterator](): Iterator<Event>;
53
+ }
54
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/hub/store/events.ts"],"names":[],"mappings":"AA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K,GACb,0BAA0B,GAC1B,uBAAuB,GACvB,6BAA6B,GAC7B,6BAA6B,GAC7B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,GACtB,yBAAyB,CAAC;AAE9B;;;;GAIG;AACH,qBAAa,gBAAgB;;IAG3B,IAAI,CAAC,GAAG,EAAE,KAAK;IAIf,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;CAgBrC"}
@@ -0,0 +1,14 @@
1
+ import type { Event } from './events.js';
2
+ import type { RawStore, State } from './store.js';
3
+ export interface Store extends Omit<RawStore, 'subscribe'> {
4
+ subscribe(listener: (event: Event, state: State, prevState: State) => void): {
5
+ flushEvents(): void;
6
+ };
7
+ }
8
+ /**
9
+ * Zustand's store provides a set of built-in functionalities,
10
+ * but it may not meet all our requirements.
11
+ * This function modifies the interface and adds or updates the available methods.
12
+ */
13
+ export declare function extend(store: RawStore): Store;
14
+ //# sourceMappingURL=extend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../src/hub/store/extend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EAIN,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,WAAW,KAAM,SAAQ,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC;IACxD,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,KAAK,IAAI,GAAG;QAC3E,WAAW,IAAI,IAAI,CAAC;KACrB,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,CA+C7C"}
@@ -0,0 +1,11 @@
1
+ /************ Hub ************/
2
+ import type { State } from './mod.js';
3
+ import type { StateCreator } from 'zustand';
4
+ type HubConfig = object;
5
+ export interface HubStore {
6
+ config: HubConfig;
7
+ }
8
+ type HubStateCreator = StateCreator<State, [], [], HubStore>;
9
+ declare const hubStore: HubStateCreator;
10
+ export { hubStore };
11
+ //# sourceMappingURL=hub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.d.ts","sourceRoot":"","sources":["../../../src/hub/store/hub.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,KAAK,eAAe,GAAG,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;AAE7D,QAAA,MAAM,QAAQ,EAAE,eAEd,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { guessProviderStateSelector, namespaceStateSelector, } from './selectors.js';
2
+ export type { Store } from './extend.js';
3
+ export type { State } from './store.js';
4
+ export type { Event, ProviderDetectedEvent, ProviderConnectingEvent, ProviderConnectedEvent, ProviderDisconnectedEvent, NamespaceDisconnectedEvent, NamespaceConnectedEvent, NamespaceSwitchedAccountEvent, } from './events.js';
5
+ export type { ProviderMetadata, ProviderConfig, ProviderInfo, } from './providers.js';
6
+ export type { NamespaceConfig, NamespaceData } from './namespaces.js';
7
+ export { createStore } from './store.js';
8
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/hub/store/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EACV,KAAK,EAEL,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EAEzB,0BAA0B,EAC1B,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ var E=Object.defineProperty;var i=(s,r)=>E(s,"name",{value:r,configurable:!0});function d(s,r){let e=s.namespaces.list,n=Object.keys(e).filter(c=>e[c].info.providerId===r),o=!!s.providers.list[r]?.data.installed,t=n.length>0?n.some(c=>e[c].data.connected):!1,a=n.length>0?n.some(c=>e[c].data.connecting):!1;return{installed:o,connected:t,connecting:a}}i(d,"guessProviderStateSelector");function u(s,r){return s.namespaces.list[r].data}i(u,"namespaceStateSelector");import{createStore as x}from"zustand/vanilla";function f(s){let r=i(e=>n=>{let o=i((t,a,c)=>{for(let p of t)n(p,a,c)},"executeListener");return e.subscribe((t,a)=>{let c=h(t,a),m=[...l(t),...c];o(m,t,a)}),{flushEvents:()=>{let t=e.getState(),a=l(t);o(a,t,t)}}},"extendedSubscribe");return new Proxy(s,{get:function(e,n,o){return n==="subscribe"?r(e):Reflect.get(e,n,o)}})}i(f,"extend");function l(s){return[...s.providers.events,...s.namespaces.events]}i(l,"tryConsumeEvents");function h(s,r){let e=[];for(let n of Object.keys(s.providers.list)){let o=d(s,n),t=d(r,n);if(t.connecting!==o.connecting){let a={type:"provider_connecting",provider:n,value:o.connecting};e.push(a)}if(!t.connected&&o.connected){let a={type:"provider_connected",provider:n};e.push(a)}if(t.connected&&!o.connected){let a={type:"provider_disconnected",provider:n};e.push(a)}}return e}i(h,"getEventsLike");var y=i(()=>({config:{}}),"hubStore");import{produce as g}from"immer";var v=class{static{i(this,"ConsumableEvents")}#e=[];push(r){this.#e.push(r)}[Symbol.iterator](){return{next:()=>this.#e.length==0?{done:!0,value:void 0}:{done:!1,value:this.#e.shift()}}}};var P=i((s,r)=>({events:new v,list:{},addNamespace:(e,n)=>{let t={data:{accounts:null,network:null,connected:!1,connecting:!1,connectArgs:null},error:"",info:n};s(g(a=>{a.namespaces.list[e]=t}))},updateStatus:(e,n,o)=>{let t=r().namespaces.list[e];if(!t)throw new Error(`No namespace with '${e}' found.`);r().namespaces._produceEventsWhenUpdatingStatus(t,e,n,o),s(g(a=>{a.namespaces.list[e].data[n]=o}))},getNamespaceData(e){return u(r(),e)},_produceEventsWhenUpdatingStatus:(e,n,o,t)=>{if(o==="accounts")if(Object.is(t,null)||Array.isArray(t)&&t.length===0){if(r().namespaces.list[n].data.connected){let p={type:"namespace_disconnected",provider:e.info.providerId,namespace:e.info.namespaceId};r().namespaces.events.push(p)}}else{let c=r().namespaces.list[n].data.accounts;if(c){if(!([...c].sort().toString()===t.sort().toString())){let m={type:"namespace_account_switched",provider:e.info.providerId,namespace:e.info.namespaceId,previousAccounts:c,accounts:t};r().namespaces.events.push(m)}}else{let p={type:"namespace_connected",provider:e.info.providerId,namespace:e.info.namespaceId,accounts:t};r().namespaces.events.push(p)}}else if(o==="network"){let a=r().namespaces.list[n].data.network,c={type:"namespace_network_switched",provider:e.info.providerId,namespace:e.info.namespaceId,network:t,previousNetwork:a};r().namespaces.events.push(c)}}}),"namespacesStore");import{produce as S}from"immer";var N=i((s,r)=>({events:new v,list:{},addProvider:(e,n)=>{let o={data:{installed:!1},error:"",config:n};s(S(t=>{t.providers.list[e]=o}))},removeProvider:e=>{s(S(n=>{delete n.providers.list[e]}))},updateStatus:(e,n,o)=>{let t=r().providers.list[e];if(!t)throw new Error(`No namespace namespace with '${e}' found.`);r().providers._produceEventsWhenUpdatingStatus(t,e,n,o),s(S(a=>{a.providers.list[e].data[n]=o}))},guessNamespacesState:e=>d(r(),e),_produceEventsWhenUpdatingStatus:(e,n,o,t)=>{if(o==="installed"){let a={type:"provider_detected",provider:n};r().providers.events.push(a)}}}),"providersStore");var w=i(()=>{let s=x((...r)=>({hub:y(...r),providers:N(...r),namespaces:P(...r)}));return f(s)},"createStore");export{w as createStore,d as guessProviderStateSelector,u as namespaceStateSelector};
2
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hub/store/selectors.ts", "../../../src/hub/store/store.ts", "../../../src/hub/store/extend.ts", "../../../src/hub/store/hub.ts", "../../../src/hub/store/namespaces.ts", "../../../src/hub/store/events.ts", "../../../src/hub/store/providers.ts"],
4
+ "sourcesContent": ["/**\n * Note: Zustand has some difficulty when you are trying to `previous` state on `subscribe`.\n * If these selectors define inside store directly and use `get()` for accessing state, it will get the latest state\n * instead of previous state which desired.\n * So make them a helper will let us to reuse them both in store and outside of store in a `subscribe`.\n */\nimport type { State } from '../mod.js';\nimport type { State as InternalProviderState } from '../provider/mod.js';\n\n/**\n * Legacy provider state includes `connecting` and `connected` values. It hadn't a separation layer for `namespaces`.\n * For compatibility reasons, we should produce these two values somehow.\n *\n * Currently, We return `true` if any of namespaces return true. We are missing failed namespace here.\n * But if we want to solve that, we should migrate our client code to use `namespace` state directly and not from `provider`\n */\nexport function guessProviderStateSelector(\n state: State,\n providerId: string\n): InternalProviderState {\n /*\n * We keep namespaces in a separate branch than providers.\n * We should look at all of them and find all the namespaces that for our current proivder.\n */\n const allNamespaces = state.namespaces.list;\n const currentProviderNamespaces = Object.keys(allNamespaces).filter(\n (key) => allNamespaces[key].info.providerId === providerId\n );\n\n // Returning provider state value directly.\n const installed = !!state.providers.list[providerId]?.data.installed;\n\n /*\n * If any namespaces returns `true`, we consider the whole provider for this field to be `true`.\n * it has a downside regarding errors which explained on top of the function.\n */\n const connected =\n currentProviderNamespaces.length > 0\n ? currentProviderNamespaces.some(\n (key) => allNamespaces[key].data.connected\n )\n : false;\n const connecting =\n currentProviderNamespaces.length > 0\n ? currentProviderNamespaces.some(\n (key) => allNamespaces[key].data.connecting\n )\n : false;\n\n return {\n installed,\n connected,\n connecting,\n };\n}\n\nexport function namespaceStateSelector(state: State, storeId: string) {\n return state.namespaces.list[storeId].data;\n}\n", "import type { StoreApi } from 'zustand/vanilla';\n\nimport { createStore as createZustandStore } from 'zustand/vanilla';\n\nimport { extend, type Store } from './extend.js';\nimport { hubStore, type HubStore } from './hub.js';\nimport { namespacesStore, type NamespaceStore } from './namespaces.js';\nimport { providersStore, type ProviderStore } from './providers.js';\n\n/************ State ************/\n\nexport interface State {\n hub: HubStore;\n providers: ProviderStore;\n namespaces: NamespaceStore;\n}\n\nexport type RawStore = StoreApi<State>;\n\nexport const createStore = (): Store => {\n const store = createZustandStore<State>((...api) => {\n return {\n hub: hubStore(...api),\n providers: providersStore(...api),\n namespaces: namespacesStore(...api),\n };\n });\n\n return extend(store);\n};\n", "import type {\n Event,\n ProviderConnectedEvent,\n ProviderConnectingEvent,\n ProviderDisconnectedEvent,\n} from './events.js';\nimport type { RawStore, State } from './store.js';\n\nimport { guessProviderStateSelector } from './selectors.js';\n\nexport interface Store extends Omit<RawStore, 'subscribe'> {\n subscribe(listener: (event: Event, state: State, prevState: State) => void): {\n flushEvents(): void;\n };\n}\n\n/**\n * Zustand's store provides a set of built-in functionalities,\n * but it may not meet all our requirements.\n * This function modifies the interface and adds or updates the available methods.\n */\nexport function extend(store: RawStore): Store {\n const extendedSubscribe: (store: RawStore) => Store['subscribe'] =\n (store) => (listener) => {\n const executeListener = (\n events: Event[],\n state: State,\n prevState: State\n ) => {\n for (const ev of events) {\n listener(ev, state, prevState);\n }\n };\n\n /*\n * only known changes will fire event for lib users\n * so all the changes in store won't trigger a user-face event\n */\n store.subscribe((state, prevState) => {\n const eventsLike = getEventsLike(state, prevState);\n const events = tryConsumeEvents(state);\n const allQueuedEvents = [...events, ...eventsLike];\n executeListener(allQueuedEvents, state, prevState);\n });\n\n return {\n /**\n * Manually run pending events.\n * This useful when use `subscribe` method after sometime and when store initialized.\n *\n * Note: Please consider both current and previous state will be same and we don't have access to previous state in a such scenario.\n */\n flushEvents: () => {\n const state = store.getState();\n const events = tryConsumeEvents(state);\n executeListener(events, state, state);\n },\n };\n };\n\n return new Proxy(store, {\n get: function (target, prop, receiver) {\n if (prop === 'subscribe') {\n return extendedSubscribe(target);\n }\n return Reflect.get(target, prop, receiver);\n },\n }) as unknown as Store;\n}\n\n/**\n * Retrieves the ConsumableEvent from the store and returns its values.\n * The values will be consumed by iterating over the field.\n */\nfunction tryConsumeEvents(state: State): Event[] {\n return [...state.providers.events, ...state.namespaces.events];\n}\n\n/**\n * In certain cases, adding events to the store is not possible (e.g., namespace or provider layer).\n * In these cases, we observe store changes and treat specific patterns as events when detected.\n *\n * Note: This approach should be avoided in most cases. It is used here to maintain backward compatibility\n * with the provider's legacy interface.\n */\nfunction getEventsLike(state: State, prevState: State): Event[] {\n const events: Event[] = [];\n\n for (const providerId of Object.keys(state.providers.list)) {\n const currentProviderState = guessProviderStateSelector(state, providerId);\n const previousProviderState = guessProviderStateSelector(\n prevState,\n providerId\n );\n\n if (previousProviderState.connecting !== currentProviderState.connecting) {\n const ev: ProviderConnectingEvent = {\n type: 'provider_connecting',\n provider: providerId,\n value: currentProviderState.connecting,\n };\n events.push(ev);\n }\n\n if (!previousProviderState.connected && currentProviderState.connected) {\n const ev: ProviderConnectedEvent = {\n type: 'provider_connected',\n provider: providerId,\n };\n\n events.push(ev);\n }\n\n if (previousProviderState.connected && !currentProviderState.connected) {\n const ev: ProviderDisconnectedEvent = {\n type: 'provider_disconnected',\n provider: providerId,\n };\n\n events.push(ev);\n }\n }\n\n return events;\n}\n", "/************ Hub ************/\n\nimport type { State } from './mod.js';\nimport type { StateCreator } from 'zustand';\n\ntype HubConfig = object;\n\nexport interface HubStore {\n config: HubConfig;\n}\n\ntype HubStateCreator = StateCreator<State, [], [], HubStore>;\n\nconst hubStore: HubStateCreator = () => ({\n config: {},\n});\n\nexport { hubStore };\n", "/************ Namespace ************/\n\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport {\n ConsumableEvents,\n type NamespaceConnectedEvent,\n type NamespaceDisconnectedEvent,\n type NamespaceSwitchedAccountEvent,\n type NamespaceSwitchedNetworkEvent,\n} from './events.js';\nimport { namespaceStateSelector, type State } from './mod.js';\n\n// Currently, namespace doesn't has any config.\nexport type NamespaceConfig = object;\n\nexport interface NamespaceData {\n accounts: null | string[];\n network: null | string;\n connected: boolean;\n connecting: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n connectArgs: Record<string, any> | null;\n}\n\ninterface NamespaceInfo {\n providerId: string;\n namespaceId: string;\n}\n\ninterface NamespaceItem {\n info: NamespaceInfo;\n data: NamespaceData;\n error: unknown;\n}\n\ntype NamespaceState = {\n events: InstanceType<typeof ConsumableEvents>;\n list: Record<string, NamespaceItem>;\n};\n\ninterface NamespaceActions {\n addNamespace: (id: string, config: NamespaceInfo) => void;\n updateStatus: <K extends keyof NamespaceData>(\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof NamespaceData>(\n namespace: NamespaceItem,\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n}\ninterface NamespaceSelectors {\n getNamespaceData(storeId: string): NamespaceData;\n}\n\nexport type NamespaceStore = NamespaceState &\n NamespaceActions &\n NamespaceSelectors;\ntype NamespaceStateCreator = StateCreator<State, [], [], NamespaceStore>;\n\nconst namespacesStore: NamespaceStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addNamespace: (id, info) => {\n const data: NamespaceData = {\n accounts: null,\n network: null,\n connected: false,\n connecting: false,\n connectArgs: null,\n };\n\n const item = {\n data,\n error: '',\n info,\n };\n\n set(\n produce((state: State) => {\n state.namespaces.list[id] = item;\n })\n );\n },\n updateStatus: (id, key, value) => {\n const ns = get().namespaces.list[id];\n if (!ns) {\n throw new Error(`No namespace with '${id}' found.`);\n }\n\n get().namespaces._produceEventsWhenUpdatingStatus(ns, id, key, value);\n\n // Updating state\n set(\n produce((state: State) => {\n state.namespaces.list[id].data[key] = value;\n })\n );\n },\n getNamespaceData(storeId) {\n return namespaceStateSelector(get(), storeId);\n },\n\n _produceEventsWhenUpdatingStatus: (namespace, id, key, value) => {\n if (key === 'accounts') {\n // check for both null and empty array\n const isAccountsEmpty =\n Object.is(value, null) || (Array.isArray(value) && value.length === 0);\n\n if (isAccountsEmpty) {\n const currentConnectedStatus = get().namespaces.list[id].data.connected;\n if (currentConnectedStatus) {\n const event: NamespaceDisconnectedEvent = {\n type: 'namespace_disconnected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n };\n\n get().namespaces.events.push(event);\n }\n // Skip emitting disconnect event, if the `connected` is false\n } else {\n const currentAccounts = get().namespaces.list[id].data.accounts;\n\n if (!currentAccounts) {\n const event: NamespaceConnectedEvent = {\n type: 'namespace_connected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n } else {\n const areSameAccounts =\n // Clone the object from the Zustand store, as it's immutable, to avoid errors during sorting.\n [...currentAccounts].sort().toString() ===\n (value as string[]).sort().toString();\n\n if (!areSameAccounts) {\n const event: NamespaceSwitchedAccountEvent = {\n type: 'namespace_account_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n previousAccounts: currentAccounts,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n }\n }\n }\n } else if (key === 'network') {\n const currentNetwork = get().namespaces.list[id].data.network;\n\n const event: NamespaceSwitchedNetworkEvent = {\n type: 'namespace_network_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n network: value as string,\n previousNetwork: currentNetwork,\n };\n\n get().namespaces.events.push(event);\n }\n },\n});\n\nexport { namespacesStore };\n", "export type NamespaceDisconnectedEvent = {\n type: 'namespace_disconnected';\n provider: string;\n namespace: string;\n};\n\nexport type NamespaceConnectedEvent = {\n type: 'namespace_connected';\n provider: string;\n namespace: string;\n accounts: string[];\n};\n\nexport type NamespaceSwitchedAccountEvent = {\n type: 'namespace_account_switched';\n provider: string;\n namespace: string;\n accounts: string[];\n previousAccounts: string[];\n};\n\nexport type NamespaceSwitchedNetworkEvent = {\n type: 'namespace_network_switched';\n provider: string;\n namespace: string;\n network: string;\n previousNetwork: string | null;\n};\n\nexport type ProviderDetectedEvent = {\n type: 'provider_detected';\n provider: string;\n};\n\nexport type ProviderConnectingEvent = {\n type: 'provider_connecting';\n provider: string;\n value: boolean;\n};\n\nexport type ProviderConnectedEvent = {\n type: 'provider_connected';\n provider: string;\n};\n\nexport type ProviderDisconnectedEvent = {\n type: 'provider_disconnected';\n provider: string;\n};\n\nexport type Event =\n | NamespaceDisconnectedEvent\n | NamespaceConnectedEvent\n | NamespaceSwitchedAccountEvent\n | NamespaceSwitchedNetworkEvent\n | ProviderDetectedEvent\n | ProviderConnectingEvent\n | ProviderConnectedEvent\n | ProviderDisconnectedEvent;\n\n/**\n *\n * Keeping an array of Event and when iterates over its values, it will be removed (consume) from the array.\n *\n */\nexport class ConsumableEvents {\n #data: Event[] = [];\n\n push(val: Event) {\n this.#data.push(val);\n }\n\n [Symbol.iterator](): Iterator<Event> {\n return {\n next: (): IteratorResult<Event> => {\n if (this.#data.length == 0) {\n return { done: true, value: undefined };\n }\n\n // Typescript can not narrow the type, but we have a runtime check to ensure it will never be an empty list\n const value = this.#data.shift()!;\n return {\n done: false,\n value,\n };\n },\n };\n }\n}\n", "import type { Namespace } from '../../namespaces/common/types.js';\nimport type { State as InternalProviderState } from '../provider/mod.js';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport { ConsumableEvents, type ProviderDetectedEvent } from './events.js';\nimport { guessProviderStateSelector, type State } from './mod.js';\n\ntype Browsers = 'firefox' | 'chrome' | 'edge' | 'brave' | 'homepage';\ntype Property<N extends string, V> = { name: N; value: V };\n\ntype NamespacesProperty = Property<\n 'namespaces',\n {\n selection: 'single' | 'multiple';\n data: {\n label: string;\n id: string;\n value: Namespace;\n unsupported?: boolean;\n getSupportedChains: (chains: BlockchainMeta[]) => BlockchainMeta[];\n }[];\n }\n>;\ntype DerivationPathProperty = Property<\n 'derivationPath',\n {\n data: {\n id: string;\n label: string;\n namespace: Namespace;\n generateDerivationPath: (index: string) => string;\n }[];\n }\n>;\ntype DetailsProperty = Property<\n 'details',\n {\n mobileWallet?: boolean;\n showOnMobile?: boolean;\n isContractWallet?: boolean;\n }\n>;\ntype SignersProperty = Property<\n 'signers',\n {\n getSigners: () => Promise<SignerFactory>;\n }\n>;\n\nexport type ProviderMetadata = {\n name: string;\n icon: string;\n extensions: Partial<Record<Browsers, string>>;\n properties?: Array<\n | NamespacesProperty\n | DerivationPathProperty\n | DetailsProperty\n | SignersProperty\n >;\n};\n\nexport interface ProviderConfig {\n metadata: ProviderMetadata;\n}\n\nexport type ProviderInfo = ProviderConfig;\n\ninterface ProviderData {\n installed: boolean;\n}\n\ninterface ProviderItem {\n config: ProviderConfig;\n data: ProviderData;\n error: unknown;\n}\n\ntype ProviderState = {\n events: ConsumableEvents;\n list: Record<string, ProviderItem>;\n};\ninterface ProviderActions {\n addProvider: (id: string, config: ProviderConfig) => void;\n removeProvider: (id: string) => void;\n updateStatus: <K extends keyof ProviderData>(\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof ProviderData>(\n provider: ProviderItem,\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n}\n\ninterface ProviderSelectors {\n /**\n * Provider has a limited state to itself, to be compatible with legacy, we try to produce same object as legacy\n * which includes namespace state as well.\n */\n guessNamespacesState: (id: string) => InternalProviderState;\n}\n\nexport type ProviderStore = ProviderState & ProviderActions & ProviderSelectors;\ntype ProvidersStateCreator = StateCreator<State, [], [], ProviderStore>;\n\nconst providersStore: ProvidersStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addProvider: (id, config) => {\n const item = {\n data: {\n installed: false,\n },\n error: '',\n config,\n };\n\n set(\n produce((state: State) => {\n state.providers.list[id] = item;\n })\n );\n },\n removeProvider: (id) => {\n set(\n produce((state: State) => {\n delete state.providers.list[id];\n })\n );\n },\n updateStatus: (id, key, value) => {\n const provider = get().providers.list[id];\n if (!provider) {\n throw new Error(`No namespace namespace with '${id}' found.`);\n }\n\n get().providers._produceEventsWhenUpdatingStatus(provider, id, key, value);\n\n set(\n produce((state: State) => {\n state.providers.list[id].data[key] = value;\n })\n );\n },\n guessNamespacesState: (providerId: string): InternalProviderState => {\n return guessProviderStateSelector(get(), providerId);\n },\n\n _produceEventsWhenUpdatingStatus: (_provider, id, key, _value) => {\n if (key === 'installed') {\n const event: ProviderDetectedEvent = {\n type: 'provider_detected',\n provider: id,\n };\n\n get().providers.events.push(event);\n }\n },\n});\n\nexport { providersStore };\n"],
5
+ "mappings": "+EAgBO,SAASA,EACdC,EACAC,EACuB,CAKvB,IAAMC,EAAgBF,EAAM,WAAW,KACjCG,EAA4B,OAAO,KAAKD,CAAa,EAAE,OAC1DE,GAAQF,EAAcE,CAAG,EAAE,KAAK,aAAeH,CAClD,EAGMI,EAAY,CAAC,CAACL,EAAM,UAAU,KAAKC,CAAU,GAAG,KAAK,UAMrDK,EACJH,EAA0B,OAAS,EAC/BA,EAA0B,KACvBC,GAAQF,EAAcE,CAAG,EAAE,KAAK,SACnC,EACA,GACAG,EACJJ,EAA0B,OAAS,EAC/BA,EAA0B,KACvBC,GAAQF,EAAcE,CAAG,EAAE,KAAK,UACnC,EACA,GAEN,MAAO,CACL,UAAAC,EACA,UAAAC,EACA,WAAAC,CACF,CACF,CAtCgBC,EAAAT,EAAA,8BAwCT,SAASU,EAAuBT,EAAcU,EAAiB,CACpE,OAAOV,EAAM,WAAW,KAAKU,CAAO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EAA0B,IAAIC,KACnC,CACL,IAAKC,EAAS,GAAGD,CAAG,EACpB,UAAWE,EAAe,GAAGF,CAAG,EAChC,WAAYG,EAAgB,GAAGH,CAAG,CACpC,EACD,EAED,OAAOI,EAAON,CAAK,CACrB,EAV2B",
6
+ "names": ["guessProviderStateSelector", "state", "providerId", "allNamespaces", "currentProviderNamespaces", "key", "installed", "connected", "connecting", "__name", "namespaceStateSelector", "storeId", "createZustandStore", "extend", "store", "extendedSubscribe", "__name", "listener", "executeListener", "events", "state", "prevState", "ev", "eventsLike", "getEventsLike", "allQueuedEvents", "tryConsumeEvents", "target", "prop", "receiver", "providerId", "currentProviderState", "guessProviderStateSelector", "previousProviderState", "hubStore", "__name", "produce", "ConsumableEvents", "__name", "#data", "val", "namespacesStore", "__name", "set", "get", "ConsumableEvents", "id", "info", "item", "produce", "state", "key", "value", "ns", "storeId", "namespaceStateSelector", "namespace", "event", "currentAccounts", "currentNetwork", "produce", "providersStore", "__name", "set", "get", "ConsumableEvents", "id", "config", "item", "produce", "state", "key", "value", "provider", "providerId", "guessProviderStateSelector", "_provider", "_value", "event", "createStore", "__name", "store", "createZustandStore", "api", "hubStore", "providersStore", "namespacesStore", "extend"]
7
+ }