@sponsorcoin/merit-wallet 0.0.0-stage → 0.0.2

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 (380) hide show
  1. package/README.md +31 -3
  2. package/dist/AgentSelectDropDown.d.ts +11 -0
  3. package/dist/AgentSelectDropDown.js +53 -0
  4. package/dist/AgentSelectDropDownWithAvatar.d.ts +10 -0
  5. package/dist/AgentSelectDropDownWithAvatar.js +13 -0
  6. package/dist/ChangePasswordPanel.d.ts +11 -0
  7. package/dist/ChangePasswordPanel.js +42 -0
  8. package/dist/ConnectedMessagePanel.d.ts +7 -0
  9. package/dist/ConnectedMessagePanel.js +37 -0
  10. package/dist/ConnectedNetworkPanel.d.ts +15 -0
  11. package/dist/ConnectedNetworkPanel.js +118 -0
  12. package/dist/DeleteWalletDialog.d.ts +13 -0
  13. package/dist/DeleteWalletDialog.js +74 -0
  14. package/dist/DialogPortal.d.ts +3 -0
  15. package/dist/DialogPortal.js +19 -0
  16. package/dist/MeritWallet.d.ts +298 -0
  17. package/dist/MeritWallet.js +2364 -0
  18. package/dist/MeritWalletHostView.d.ts +19 -0
  19. package/dist/MeritWalletHostView.js +16 -0
  20. package/dist/PasswordPromptDialog.d.ts +8 -0
  21. package/dist/PasswordPromptDialog.js +33 -0
  22. package/dist/RecoveryPhraseScreen.d.ts +9 -0
  23. package/dist/RecoveryPhraseScreen.js +29 -0
  24. package/dist/SecuritySetupScreen.d.ts +44 -0
  25. package/dist/SecuritySetupScreen.js +119 -0
  26. package/dist/SecurityWarningScreen.d.ts +5 -0
  27. package/dist/SecurityWarningScreen.js +18 -0
  28. package/dist/TestAccountsSection.d.ts +26 -0
  29. package/dist/TestAccountsSection.js +64 -0
  30. package/dist/TokenPanel.d.ts +9 -0
  31. package/dist/TokenPanel.js +130 -0
  32. package/dist/TokenSlotPanels.d.ts +19 -0
  33. package/dist/TokenSlotPanels.js +115 -0
  34. package/dist/UnlockSecondStep.d.ts +7 -0
  35. package/dist/UnlockSecondStep.js +50 -0
  36. package/dist/VaultAccountsPanel.d.ts +27 -0
  37. package/dist/VaultAccountsPanel.js +125 -0
  38. package/dist/WalletOnboardingPanel.d.ts +13 -0
  39. package/dist/WalletOnboardingPanel.js +105 -0
  40. package/dist/WalletSecuritySection.d.ts +9 -0
  41. package/dist/WalletSecuritySection.js +45 -0
  42. package/dist/account/AccountDetailScreen.d.ts +37 -0
  43. package/dist/account/AccountDetailScreen.js +92 -0
  44. package/dist/account/AccountPrivateKeyRow.d.ts +19 -0
  45. package/dist/account/AccountPrivateKeyRow.js +60 -0
  46. package/dist/account/AccountProfileEditor.d.ts +23 -0
  47. package/dist/account/AccountProfileEditor.js +43 -0
  48. package/dist/account/AddAccountFlow.d.ts +65 -0
  49. package/dist/account/AddAccountFlow.js +287 -0
  50. package/dist/account/DetailImageBlock.d.ts +44 -0
  51. package/dist/account/DetailImageBlock.js +46 -0
  52. package/dist/account/DetailScreenLayout.d.ts +38 -0
  53. package/dist/account/DetailScreenLayout.js +30 -0
  54. package/dist/account/MetaDetailScreen.d.ts +30 -0
  55. package/dist/account/MetaDetailScreen.js +33 -0
  56. package/dist/account/RemoveAccountPanel.d.ts +14 -0
  57. package/dist/account/RemoveAccountPanel.js +97 -0
  58. package/dist/account/accountDetailHostFromProfile.d.ts +23 -0
  59. package/dist/account/accountDetailHostFromProfile.js +25 -0
  60. package/dist/account/accountSource.d.ts +36 -0
  61. package/dist/account/accountSource.js +82 -0
  62. package/dist/account/form/AccountAvatarPanel.d.ts +42 -0
  63. package/dist/account/form/AccountAvatarPanel.js +38 -0
  64. package/dist/account/form/AccountFormPanel.d.ts +50 -0
  65. package/dist/account/form/AccountFormPanel.js +124 -0
  66. package/dist/account/form/AvatarControls.d.ts +25 -0
  67. package/dist/account/form/AvatarControls.js +27 -0
  68. package/dist/account/form/AvatarPicture.d.ts +11 -0
  69. package/dist/account/form/AvatarPicture.js +11 -0
  70. package/dist/account/form/CopyIcon.d.ts +1 -0
  71. package/dist/account/form/CopyIcon.js +7 -0
  72. package/dist/account/form/DisconnectedControl.d.ts +6 -0
  73. package/dist/account/form/DisconnectedControl.js +8 -0
  74. package/dist/account/form/formHelpers.d.ts +37 -0
  75. package/dist/account/form/formHelpers.js +180 -0
  76. package/dist/account/form/formTypes.d.ts +11 -0
  77. package/dist/account/form/formTypes.js +1 -0
  78. package/dist/account/form/useAccountForm.d.ts +70 -0
  79. package/dist/account/form/useAccountForm.js +555 -0
  80. package/dist/account/form/useAccountFormDerivedState.d.ts +27 -0
  81. package/dist/account/form/useAccountFormDerivedState.js +59 -0
  82. package/dist/account/form/useAccountLiveRefresh.d.ts +15 -0
  83. package/dist/account/form/useAccountLiveRefresh.js +46 -0
  84. package/dist/account/form/useAvatarPreviewSize.d.ts +39 -0
  85. package/dist/account/form/useAvatarPreviewSize.js +245 -0
  86. package/dist/account/logoImage.d.ts +1 -0
  87. package/dist/account/logoImage.js +49 -0
  88. package/dist/account/profileForm.d.ts +22 -0
  89. package/dist/account/profileForm.js +63 -0
  90. package/dist/account/responseFailure.d.ts +1 -0
  91. package/dist/account/responseFailure.js +7 -0
  92. package/dist/account/signIn.d.ts +13 -0
  93. package/dist/account/signIn.js +51 -0
  94. package/dist/approval/approvalLifecycle.d.ts +15 -0
  95. package/dist/approval/approvalLifecycle.js +51 -0
  96. package/dist/approval/meritApproval.d.ts +182 -0
  97. package/dist/approval/meritApproval.js +198 -0
  98. package/dist/approval/pendingApprovalMessageStore.d.ts +7 -0
  99. package/dist/approval/pendingApprovalMessageStore.js +18 -0
  100. package/dist/approval/useMeritApprovalMessagePanel.d.ts +7 -0
  101. package/dist/approval/useMeritApprovalMessagePanel.js +132 -0
  102. package/dist/auth/accountNoticeStore.d.ts +22 -0
  103. package/dist/auth/accountNoticeStore.js +31 -0
  104. package/dist/auth/approvalWaiting.d.ts +44 -0
  105. package/dist/auth/approvalWaiting.js +122 -0
  106. package/dist/auth/authenticationType.d.ts +6 -0
  107. package/dist/auth/authenticationType.js +24 -0
  108. package/dist/auth/authenticator.d.ts +142 -0
  109. package/dist/auth/authenticator.js +65 -0
  110. package/dist/auth/connect.d.ts +38 -0
  111. package/dist/auth/connect.js +87 -0
  112. package/dist/auth/hardwareAuthenticator.d.ts +41 -0
  113. package/dist/auth/hardwareAuthenticator.js +90 -0
  114. package/dist/auth/hardwareShared.d.ts +42 -0
  115. package/dist/auth/hardwareShared.js +83 -0
  116. package/dist/auth/injectedAuthenticator.d.ts +25 -0
  117. package/dist/auth/injectedAuthenticator.js +155 -0
  118. package/dist/auth/keptAccounts.d.ts +14 -0
  119. package/dist/auth/keptAccounts.js +126 -0
  120. package/dist/auth/ledgerTransport.d.ts +62 -0
  121. package/dist/auth/ledgerTransport.js +167 -0
  122. package/dist/auth/meritConnection.d.ts +31 -0
  123. package/dist/auth/meritConnection.js +65 -0
  124. package/dist/auth/registerApprovingWallet.d.ts +1 -0
  125. package/dist/auth/registerApprovingWallet.js +15 -0
  126. package/dist/auth/resolve.d.ts +29 -0
  127. package/dist/auth/resolve.js +68 -0
  128. package/dist/auth/trezorTransport.d.ts +74 -0
  129. package/dist/auth/trezorTransport.js +126 -0
  130. package/dist/auth/useAccountNoticeMessagePanel.d.ts +5 -0
  131. package/dist/auth/useAccountNoticeMessagePanel.js +54 -0
  132. package/dist/auth/useApprovalMessagePanel.d.ts +2 -0
  133. package/dist/auth/useApprovalMessagePanel.js +47 -0
  134. package/dist/auth/walletAuthenticators.d.ts +35 -0
  135. package/dist/auth/walletAuthenticators.js +83 -0
  136. package/dist/auth/walletAuthenticatorsReact.d.ts +9 -0
  137. package/dist/auth/walletAuthenticatorsReact.js +14 -0
  138. package/dist/balance/createBalanceReader.d.ts +23 -0
  139. package/dist/balance/createBalanceReader.js +24 -0
  140. package/dist/chain/chainReconcile.d.ts +68 -0
  141. package/dist/chain/chainReconcile.js +139 -0
  142. package/dist/chain/directReads.d.ts +34 -0
  143. package/dist/chain/directReads.js +60 -0
  144. package/dist/config/ConnectedWalletConfig.d.ts +24 -0
  145. package/dist/config/ConnectedWalletConfig.js +18 -0
  146. package/dist/config/WalletSessionDialogs.d.ts +17 -0
  147. package/dist/config/WalletSessionDialogs.js +30 -0
  148. package/dist/debug/DebugBug.d.ts +8 -0
  149. package/dist/debug/DebugBug.js +74 -0
  150. package/dist/debug/debugStore.d.ts +39 -0
  151. package/dist/debug/debugStore.js +148 -0
  152. package/dist/hostContract.d.ts +93 -0
  153. package/dist/hostContract.js +1 -0
  154. package/dist/index.d.ts +163 -0
  155. package/dist/index.js +135 -0
  156. package/dist/injectableComponentTypes.d.ts +97 -0
  157. package/dist/injectableComponentTypes.js +12 -0
  158. package/dist/keystore/index.d.ts +3 -0
  159. package/dist/keystore/index.js +10 -0
  160. package/dist/keystore/publicAccountStore.d.ts +14 -0
  161. package/dist/keystore/publicAccountStore.js +29 -0
  162. package/dist/keystore/secretCache.d.ts +20 -0
  163. package/dist/keystore/secretCache.js +48 -0
  164. package/dist/panels/AccountDetailPanel.d.ts +14 -0
  165. package/dist/panels/AccountDetailPanel.js +82 -0
  166. package/dist/panels/AcknowledgeDialog.d.ts +6 -0
  167. package/dist/panels/AcknowledgeDialog.js +14 -0
  168. package/dist/panels/ActiveAccountSelectDropDown.d.ts +22 -0
  169. package/dist/panels/ActiveAccountSelectDropDown.js +57 -0
  170. package/dist/panels/AddressPanel.d.ts +9 -0
  171. package/dist/panels/AddressPanel.js +17 -0
  172. package/dist/panels/AgentSelectDropDown.d.ts +44 -0
  173. package/dist/panels/AgentSelectDropDown.js +63 -0
  174. package/dist/panels/AnonymousAvatar.d.ts +6 -0
  175. package/dist/panels/AnonymousAvatar.js +27 -0
  176. package/dist/panels/DetailRow.d.ts +11 -0
  177. package/dist/panels/DetailRow.js +13 -0
  178. package/dist/panels/HexAddressInput.d.ts +11 -0
  179. package/dist/panels/HexAddressInput.js +49 -0
  180. package/dist/panels/MenuTabHeaderBar.d.ts +51 -0
  181. package/dist/panels/MenuTabHeaderBar.js +55 -0
  182. package/dist/panels/MeritInfoPanel.d.ts +11 -0
  183. package/dist/panels/MeritInfoPanel.js +17 -0
  184. package/dist/panels/MeritInfoPanelReal.d.ts +7 -0
  185. package/dist/panels/MeritInfoPanelReal.js +73 -0
  186. package/dist/panels/MessageDetailsSection.d.ts +12 -0
  187. package/dist/panels/MessageDetailsSection.js +29 -0
  188. package/dist/panels/MessageLabelValueRow.d.ts +5 -0
  189. package/dist/panels/MessageLabelValueRow.js +11 -0
  190. package/dist/panels/MessagePanel.d.ts +19 -0
  191. package/dist/panels/MessagePanel.js +41 -0
  192. package/dist/panels/MessagePanelReal.d.ts +60 -0
  193. package/dist/panels/MessagePanelReal.js +191 -0
  194. package/dist/panels/NetworkDetailPanel.d.ts +8 -0
  195. package/dist/panels/NetworkDetailPanel.js +25 -0
  196. package/dist/panels/NetworkSelectDropDown.d.ts +21 -0
  197. package/dist/panels/NetworkSelectDropDown.js +56 -0
  198. package/dist/panels/PanelTitle.d.ts +23 -0
  199. package/dist/panels/PanelTitle.js +35 -0
  200. package/dist/panels/ReadOnlyMetaDataTable.d.ts +19 -0
  201. package/dist/panels/ReadOnlyMetaDataTable.js +21 -0
  202. package/dist/panels/SendTabPanel.d.ts +45 -0
  203. package/dist/panels/SendTabPanel.js +57 -0
  204. package/dist/panels/TokenAddressComponent.d.ts +12 -0
  205. package/dist/panels/TokenAddressComponent.js +46 -0
  206. package/dist/panels/TokenDetailPanel.d.ts +14 -0
  207. package/dist/panels/TokenDetailPanel.js +32 -0
  208. package/dist/panels/TokenSelectDropDown.d.ts +53 -0
  209. package/dist/panels/TokenSelectDropDown.js +54 -0
  210. package/dist/panels/TradingStationPanel.d.ts +9 -0
  211. package/dist/panels/TradingStationPanel.js +62 -0
  212. package/dist/panels/WalletAccountHeader.d.ts +50 -0
  213. package/dist/panels/WalletAccountHeader.js +64 -0
  214. package/dist/panels/WalletAccountSelectDropDown.d.ts +15 -0
  215. package/dist/panels/WalletAccountSelectDropDown.js +42 -0
  216. package/dist/panels/WalletRadioPanels.d.ts +13 -0
  217. package/dist/panels/WalletRadioPanels.js +110 -0
  218. package/dist/panels/clipboardClear.d.ts +7 -0
  219. package/dist/panels/clipboardClear.js +31 -0
  220. package/dist/panels/errorPanelDisplayStore.d.ts +8 -0
  221. package/dist/panels/errorPanelDisplayStore.js +46 -0
  222. package/dist/panels/index.d.ts +38 -0
  223. package/dist/panels/index.js +27 -0
  224. package/dist/panels/meritWalletDataFetch.d.ts +53 -0
  225. package/dist/panels/meritWalletDataFetch.js +225 -0
  226. package/dist/panels/recordFields.d.ts +51 -0
  227. package/dist/panels/recordFields.js +147 -0
  228. package/dist/panels/useChainInfo.d.ts +5 -0
  229. package/dist/panels/useChainInfo.js +28 -0
  230. package/dist/peer/peerConnection.d.ts +43 -0
  231. package/dist/peer/peerConnection.js +126 -0
  232. package/dist/platform/domPlatform.d.ts +2 -0
  233. package/dist/platform/domPlatform.js +162 -0
  234. package/dist/platform/platform.d.ts +45 -0
  235. package/dist/platform/platform.js +12 -0
  236. package/dist/platform/useCopyFeedback.d.ts +5 -0
  237. package/dist/platform/useCopyFeedback.js +24 -0
  238. package/dist/provider/injectedWallet.d.ts +48 -0
  239. package/dist/provider/injectedWallet.js +62 -0
  240. package/dist/provider/useMeritLink.d.ts +8 -0
  241. package/dist/provider/useMeritLink.js +8 -0
  242. package/dist/provider/useMetaMask.d.ts +11 -0
  243. package/dist/provider/useMetaMask.js +67 -0
  244. package/dist/radioPanelGroups.d.ts +25 -0
  245. package/dist/radioPanelGroups.js +85 -0
  246. package/dist/receipt/transactionReceipts.d.ts +90 -0
  247. package/dist/receipt/transactionReceipts.js +159 -0
  248. package/dist/receipt/useTransactionReceipt.d.ts +2 -0
  249. package/dist/receipt/useTransactionReceipt.js +18 -0
  250. package/dist/refresh/refreshReact.d.ts +30 -0
  251. package/dist/refresh/refreshReact.js +101 -0
  252. package/dist/refresh/refreshTree.d.ts +42 -0
  253. package/dist/refresh/refreshTree.js +81 -0
  254. package/dist/rewards/ConnectedRewardsPanel.d.ts +57 -0
  255. package/dist/rewards/ConnectedRewardsPanel.js +129 -0
  256. package/dist/rewards/accountRoleFlags.d.ts +1 -0
  257. package/dist/rewards/accountRoleFlags.js +25 -0
  258. package/dist/rewards/chainClock.d.ts +17 -0
  259. package/dist/rewards/chainClock.js +63 -0
  260. package/dist/rewards/estimateRewards.d.ts +45 -0
  261. package/dist/rewards/estimateRewards.js +224 -0
  262. package/dist/security/mfaFactorsStore.d.ts +16 -0
  263. package/dist/security/mfaFactorsStore.js +55 -0
  264. package/dist/security/passkey.d.ts +20 -0
  265. package/dist/security/passkey.js +60 -0
  266. package/dist/security/secretClearing.d.ts +17 -0
  267. package/dist/security/secretClearing.js +62 -0
  268. package/dist/security/signInOptions.d.ts +20 -0
  269. package/dist/security/signInOptions.js +12 -0
  270. package/dist/security/totp.d.ts +13 -0
  271. package/dist/security/totp.js +77 -0
  272. package/dist/send/SendComponent.d.ts +1 -0
  273. package/dist/send/SendComponent.js +120 -0
  274. package/dist/send/sendTransfer.d.ts +61 -0
  275. package/dist/send/sendTransfer.js +59 -0
  276. package/dist/session/activeAccountCore.d.ts +81 -0
  277. package/dist/session/activeAccountCore.js +57 -0
  278. package/dist/session/indexedDbKey.d.ts +12 -0
  279. package/dist/session/indexedDbKey.js +39 -0
  280. package/dist/session/persistedPassword.d.ts +23 -0
  281. package/dist/session/persistedPassword.js +65 -0
  282. package/dist/session/validateLogin.d.ts +39 -0
  283. package/dist/session/validateLogin.js +55 -0
  284. package/dist/session/walletSession.d.ts +58 -0
  285. package/dist/session/walletSession.js +89 -0
  286. package/dist/session/walletSessionReact.d.ts +10 -0
  287. package/dist/session/walletSessionReact.js +41 -0
  288. package/dist/sponsor/ConnectedSponsorPanel.d.ts +7 -0
  289. package/dist/sponsor/ConnectedSponsorPanel.js +32 -0
  290. package/dist/sponsor/ConnectedSponsorStakingList.d.ts +46 -0
  291. package/dist/sponsor/ConnectedSponsorStakingList.js +320 -0
  292. package/dist/sponsor/sponsorReads.d.ts +56 -0
  293. package/dist/sponsor/sponsorReads.js +181 -0
  294. package/dist/sponsor/stakingListMode.d.ts +9 -0
  295. package/dist/sponsor/stakingListMode.js +20 -0
  296. package/dist/sponsor/unstakeWalk.d.ts +37 -0
  297. package/dist/sponsor/unstakeWalk.js +148 -0
  298. package/dist/swap/ConnectedUniSelectPanel.d.ts +7 -0
  299. package/dist/swap/ConnectedUniSelectPanel.js +23 -0
  300. package/dist/swap/SwapTradeButton.d.ts +41 -0
  301. package/dist/swap/SwapTradeButton.js +49 -0
  302. package/dist/swap/activeAccountProfile.d.ts +9 -0
  303. package/dist/swap/activeAccountProfile.js +11 -0
  304. package/dist/swap/parseDecimalAmount.d.ts +5 -0
  305. package/dist/swap/parseDecimalAmount.js +26 -0
  306. package/dist/swap/quoteClient.d.ts +28 -0
  307. package/dist/swap/quoteClient.js +50 -0
  308. package/dist/swap/swapPrice.d.ts +30 -0
  309. package/dist/swap/swapPrice.js +46 -0
  310. package/dist/swap/useSwapQuote.d.ts +20 -0
  311. package/dist/swap/useSwapQuote.js +142 -0
  312. package/dist/sync/pushContextPatch.d.ts +24 -0
  313. package/dist/sync/pushContextPatch.js +19 -0
  314. package/dist/sync/syncToken.d.ts +52 -0
  315. package/dist/sync/syncToken.js +128 -0
  316. package/dist/trade/tradeHost.d.ts +37 -0
  317. package/dist/trade/tradeHost.js +29 -0
  318. package/dist/vault/accountTransfer.d.ts +25 -0
  319. package/dist/vault/accountTransfer.js +61 -0
  320. package/dist/vault/approvals.d.ts +39 -0
  321. package/dist/vault/approvals.js +72 -0
  322. package/dist/vault/browserStorage.d.ts +12 -0
  323. package/dist/vault/browserStorage.js +74 -0
  324. package/dist/vault/index.d.ts +9 -0
  325. package/dist/vault/index.js +14 -0
  326. package/dist/vault/localSigner.d.ts +53 -0
  327. package/dist/vault/localSigner.js +112 -0
  328. package/dist/vault/phoneVault.d.ts +52 -0
  329. package/dist/vault/phoneVault.js +146 -0
  330. package/dist/vault/providerController.d.ts +103 -0
  331. package/dist/vault/providerController.js +325 -0
  332. package/dist/vault/vaultAuthenticator.d.ts +17 -0
  333. package/dist/vault/vaultAuthenticator.js +72 -0
  334. package/dist/vault/vaultCapability.d.ts +100 -0
  335. package/dist/vault/vaultCapability.js +180 -0
  336. package/dist/vault/vaultCrypto.d.ts +35 -0
  337. package/dist/vault/vaultCrypto.js +95 -0
  338. package/dist/vault/vaultSession.d.ts +117 -0
  339. package/dist/vault/vaultSession.js +253 -0
  340. package/dist/vault/walletAccounts.d.ts +121 -0
  341. package/dist/vault/walletAccounts.js +337 -0
  342. package/dist/vault/workerVault.d.ts +47 -0
  343. package/dist/vault/workerVault.js +195 -0
  344. package/dist/wallet/AccountSigningSection.d.ts +5 -0
  345. package/dist/wallet/AccountSigningSection.js +39 -0
  346. package/dist/wallet/WalletBackupSection.d.ts +6 -0
  347. package/dist/wallet/WalletBackupSection.js +35 -0
  348. package/dist/wallet/accountHolders.d.ts +9 -0
  349. package/dist/wallet/accountHolders.js +22 -0
  350. package/dist/wallet/accountSigning.d.ts +29 -0
  351. package/dist/wallet/accountSigning.js +56 -0
  352. package/dist/wallet/addTarget.d.ts +24 -0
  353. package/dist/wallet/addTarget.js +35 -0
  354. package/dist/wallet/approverAccounts.d.ts +92 -0
  355. package/dist/wallet/approverAccounts.js +222 -0
  356. package/dist/wallet/approverAccountsReact.d.ts +15 -0
  357. package/dist/wallet/approverAccountsReact.js +171 -0
  358. package/dist/wallet/sameAddress.d.ts +1 -0
  359. package/dist/wallet/sameAddress.js +4 -0
  360. package/dist/wallet/wallet.d.ts +80 -0
  361. package/dist/wallet/wallet.js +211 -0
  362. package/dist/wallet/walletLock.d.ts +27 -0
  363. package/dist/wallet/walletLock.js +91 -0
  364. package/dist/wallet/walletProps.d.ts +20 -0
  365. package/dist/wallet/walletProps.js +83 -0
  366. package/dist/wallet/walletSecurity.d.ts +4 -0
  367. package/dist/wallet/walletSecurity.js +36 -0
  368. package/dist/wallet/walletSlugs.d.ts +2 -0
  369. package/dist/wallet/walletSlugs.js +7 -0
  370. package/dist/walletConfig.d.ts +55 -0
  371. package/dist/walletConfig.js +176 -0
  372. package/dist/walletConfigPanelProps.d.ts +52 -0
  373. package/dist/walletConfigPanelProps.js +59 -0
  374. package/dist/walletData.d.ts +18 -0
  375. package/dist/walletData.js +17 -0
  376. package/dist/walletRefresh.d.ts +22 -0
  377. package/dist/walletRefresh.js +60 -0
  378. package/dist/walletSessionHost.d.ts +17 -0
  379. package/dist/walletSessionHost.js +1 -0
  380. package/package.json +37 -4
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @sponsorcoin/merit-wallet
2
+
3
+ The Merit Wallet component, shared by the web app, the browser extension and later the phone apps.
4
+
5
+ Status (2026-10-08): created by moving `MeritWallet.tsx` out of `@sponsorcoin/spcoin-panels`, unchanged apart from its imports.
6
+ It depends on `@sponsorcoin/spcoin-panels` (peer dependency). The plan for merging the web and extension wallets into this one component
7
+ is in `docs/meritWalletNpmDesignToDo.txt` of the web app repo.
8
+
9
+ Build: `npm run build` (tsc, output in `dist/`, which is tracked like the other packages).
10
+
11
+ ## Host injectables and defaults
12
+
13
+ The wallet owns portable defaults where they are safe. Hosts inject the parts that differ by deployment. An empty optional hook or API is not a working implementation: required behavior must be supplied by the host.
14
+
15
+ | Injectable | Wallet default | What an app overrides it for | Who supplies it today |
16
+ | --- | --- | --- | --- |
17
+ | `MeritWalletApi` (`session`, `accounts`, `signing`) | `createWallet()` supplies an empty authenticator registry and in-memory active-authenticator selection; it does not create a vault or sign. | Connect the wallet UI to a real vault, accounts, approvals, signing, and transaction transport. | Web: `webWallet` and `webApprovers` backed by wallet state/server routes. Extension: local vault and background worker. |
18
+ | `createWallet` registry, default backend, and active-authenticator store | Empty registry; `appDefault` is required; active selection falls back to memory. | Register the host's signers and persist account-to-signer selection. | Web: server keystore authenticator and web default. Extension: local vault authenticator and extension storage. |
19
+ | Vault storage and capability | `VaultSession` and `createLocalVault` implement crypto and account operations; the host must provide ciphertext storage. | Choose secure persistence and an unlock lifecycle for the device. | Web uses its server keystore. Extension uses `chrome.storage` through the background worker. |
20
+ | `MeritWalletApi.networks` | Network data comes from shared `spcoin-feeds`; wallet selection helpers do not own persistence. | Supply a different network set or persist active-network changes. | Web: shared registry plus app chain selection. Extension: shared registry plus extension chain selection. |
21
+ | `WalletDataSource.resolveNetwork` | Shared `spcoin-feeds` resolver when omitted by consumers that use the shared network helper. | Use an app-specific registry. | Web and extension use shared feeds; no separate resolver is currently injected. |
22
+ | `WalletDataSource.loadNetworkInfo` | Relative fetch from `/assets/blockchains/<chainId>/info.json` in the panel layer. | Change the asset origin or provide a native/platform data source. | Web uses same-origin assets. Extension supplies its packaged asset base URL. |
23
+ | `WalletDataSource.loadTokenRecord` | No loader; token detail can remain partial when no loader is supplied. | Hydrate an address-only token from the app's token registry. | Web supplies its token store loader. Extension currently leaves it unset. |
24
+ | `MeritPlatform` | `domPlatform`: browser clipboard, URL opening, file download, localStorage preferences, visibility and focus. | Replace browser operations with native share/storage/lifecycle behavior. | Web and extension use the package default. |
25
+ | `walletAssetBaseUrl` | Empty base URL, so assets resolve from the current origin. | Point packaged wallet identity assets at an extension or other app bundle. | Web uses its origin. Extension supplies `chrome.runtime.getURL('')`. |
26
+ | Sponsor read cache store | LocalStorage with memory fallback. | Share/cache sponsor totals through an app backend or platform storage. | Web registers the HTTP cache store. Extension uses the local default. |
27
+ | Sponsor read transport (`SpCoinReadStepFn`) | HTTP POST to the same-origin `/api/spCoin/run-script` route. | Use a direct RPC client or another route when the host has no web server. | Web uses the default route. Extension injects direct chain RPC. |
28
+ | Hosted API base | Enabled by default for engine features that use host API routes. | Disable hosted reads when running without the web server, or select another API base. | Web keeps the same-origin API. Extension disables hosted API calls. |
29
+ | Account/profile source | No universal profile backend; package offers account profile UI/client contracts. | Load and persist account labels, profiles, and active account for the host. | Web uses account API/store. Extension uses its local profile adapter and bundled assets. |
30
+
31
+ These defaults are runtime behavior, not a claim that every host can run without configuration: vault operations, token hydration, and chain reads require their corresponding host implementation. Keep host adapters limited to those real differences; do not copy package defaults into host code.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { spCoinAccount } from '@sponsorcoin/spcoin-common/context';
3
+ import { SP_COIN_DISPLAY } from '@sponsorcoin/spcoin-common/panels';
4
+ export interface ConnectedAgentSelectDropDownProps {
5
+ panelGateId?: SP_COIN_DISPLAY | null;
6
+ label?: string;
7
+ addrPrePostSize?: number;
8
+ /** Host-specific avatar for a selected agent (the web app's opens the account panel on click). Default: the package's plain AccountAvatar. */
9
+ renderAccountAvatar?: (account: spCoinAccount) => React.ReactNode;
10
+ }
11
+ export default function ConnectedAgentSelectDropDown({ panelGateId, label, addrPrePostSize, renderAccountAvatar, }: ConnectedAgentSelectDropDownProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/AgentSelectDropDown.tsx
2
+ //
3
+ // 2026-10-08 (docs/meritWalletNpmDesignToDo.txt row 5, S2b-2) -- the agent picker, wired to the exchange engine, written once for both
4
+ // hosts. It is a move, not a rewrite, of the web app's node_source/spCoinPanels/AssetSelectDropDowns/AgentSelectDropDown.tsx: the same
5
+ // data resolution (useAgentAccount), the same open/close orchestration (useOpenActiveListPanel), the same Sponsor/Recipient/Agent
6
+ // mutual-exclusion rule (validateAccount), feeding the portable, hook-free AgentSelectDropDown from @sponsorcoin/spcoin-panels. Only
7
+ // engine and package imports are used, so it runs wherever an ExchangeContext provider does: the web app's ExchangeProvider and the
8
+ // extension's LiteExchangeProvider.
9
+ //
10
+ // The one host-specific thing is the avatar. The web app's avatar opens the account panel on click (web-only hooks), so a host that wants
11
+ // that passes renderAccountAvatar; without it the package's plain AccountAvatar is used (no click behaviour).
12
+ 'use client';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { panelPartClass } from '@sponsorcoin/spcoin-common/styles';
15
+ import { useCallback } from 'react';
16
+ import { FEED_TYPE } from '@sponsorcoin/spcoin-common/context';
17
+ import { SP_COIN_DISPLAY } from '@sponsorcoin/spcoin-common/panels';
18
+ import { useExchangeContext, usePanelVisible, useOpenActiveListPanel, useAgentAccount, validateAccount, } from '@sponsorcoin/spcoin-exchange-engine';
19
+ import { AccountAvatar, PanelGate } from '@sponsorcoin/spcoin-panels';
20
+ import { AgentSelectDropDown as PortableAgentSelectDropDown } from './panels';
21
+ export default function ConnectedAgentSelectDropDown({ panelGateId, label = 'Select Agent', addrPrePostSize = 4, renderAccountAvatar, }) {
22
+ const { exchangeContext } = useExchangeContext();
23
+ const [agentAccount, setAgentAccount] = useAgentAccount();
24
+ const { openActiveListPanel, closeActiveListPanel } = useOpenActiveListPanel();
25
+ const agentListVisible = usePanelVisible(SP_COIN_DISPLAY.REMOTE_ACCOUNT_AGENT_LIST);
26
+ const address = String(agentAccount?.address ?? '');
27
+ // A real account with a deliberately blanked address is the "unselected" placeholder.
28
+ const isUnselected = !!agentAccount && !address;
29
+ const openAgentList = useCallback((e) => {
30
+ e.preventDefault();
31
+ e.stopPropagation();
32
+ if (agentListVisible) {
33
+ closeActiveListPanel('AgentSelectDropDown:closeAgentList');
34
+ return;
35
+ }
36
+ openActiveListPanel({
37
+ feedType: FEED_TYPE.REMOTE_AGENT_ACCOUNTS,
38
+ onCommit: (asset) => setAgentAccount(asset),
39
+ selectOnLogoClick: true,
40
+ currentTokenAddress: address || undefined,
41
+ validateSelection: (addr) => validateAccount('AGENT', addr, exchangeContext?.apiCoreSyncedMembers?.accounts ?? {}),
42
+ }, 'AgentSelectDropDown:openAgentList', SP_COIN_DISPLAY.REMOTE_ACCOUNT_AGENT_LIST);
43
+ }, [agentListVisible, openActiveListPanel, closeActiveListPanel, setAgentAccount, exchangeContext?.apiCoreSyncedMembers?.accounts, address]);
44
+ return (_jsx(PortableAgentSelectDropDown
45
+ // No agent (never selected, or selection cleared) falls through to the portable component's shared Anonymous avatar.
46
+ , {
47
+ // No agent (never selected, or selection cleared) falls through to the portable component's shared Anonymous avatar.
48
+ icon: agentAccount && !isUnselected
49
+ ? (renderAccountAvatar
50
+ ? renderAccountAvatar(agentAccount)
51
+ : _jsx(AccountAvatar, { account: agentAccount, mode: SP_COIN_DISPLAY.AGENT_ACCOUNT, className: panelPartClass.avatarFill, roleLabel: "AGENT" }))
52
+ : undefined, address: isUnselected ? undefined : address || undefined, symbol: isUnselected ? undefined : agentAccount?.symbol, placeholderLabel: label, onSelectClick: openAgentList, listOpen: agentListVisible, addrPrePostSize: addrPrePostSize, panelGateId: panelGateId === null ? undefined : (panelGateId ?? SP_COIN_DISPLAY.AGENT_SELECT_DROP_DOWN), panelGate: panelGateId === null ? undefined : PanelGate }));
53
+ }
@@ -0,0 +1,10 @@
1
+ import { SP_COIN_DISPLAY } from '@sponsorcoin/spcoin-common/panels';
2
+ interface Props {
3
+ panelGateId?: SP_COIN_DISPLAY | null;
4
+ label?: string;
5
+ addrPrePostSize?: number;
6
+ /** Accepted and ignored, so existing callers do not change. */
7
+ collapseKey?: unknown;
8
+ }
9
+ export default function AgentSelectDropDownWithAvatar({ panelGateId, label, addrPrePostSize }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ // File: src/AgentSelectDropDownWithAvatar.tsx
2
+ //
3
+ // 2026-10-10 (docs/nodeSourceMigrationPlan.txt row 16) -- the agent picker as the web app mounts it, moved from node_source/spCoinPanels/AssetSelectDropDowns/AgentSelectDropDown.tsx: this package's ConnectedAgentSelectDropDown with the shared avatar that opens
4
+ // the account panel on click (spcoin-panels' AccountAvatarWithOpen), so a host no longer has to write the adapter.
5
+ 'use client';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { panelPartClass } from '@sponsorcoin/spcoin-common/styles';
8
+ import { SP_COIN_DISPLAY } from '@sponsorcoin/spcoin-common/panels';
9
+ import { AccountAvatarWithOpen } from '@sponsorcoin/spcoin-panels';
10
+ import ConnectedAgentSelectDropDown from './AgentSelectDropDown';
11
+ export default function AgentSelectDropDownWithAvatar({ panelGateId, label = 'Select Agent', addrPrePostSize = 4 }) {
12
+ return (_jsx(ConnectedAgentSelectDropDown, { panelGateId: panelGateId, label: label, addrPrePostSize: addrPrePostSize, renderAccountAvatar: (account) => _jsx(AccountAvatarWithOpen, { account: account, mode: SP_COIN_DISPLAY.AGENT_ACCOUNT, className: panelPartClass.avatarFill, roleLabel: "AGENT" }) }));
13
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 2026-10-11 (docs/design/accountAuthDesign.txt 14.3, item V5): `note` is the host's own small print (the web's development keystore says that every account is re-encrypted); `title` and `confirmLabel`
3
+ * let a host keep its wording. The new password must also differ from the current one.
4
+ */
5
+ export default function ChangePasswordPanel({ changePassword, onDone, note, title, confirmLabel }: {
6
+ changePassword(oldPassword: string, newPassword: string): Promise<void>;
7
+ onDone(): void;
8
+ note?: string;
9
+ title?: string;
10
+ confirmLabel?: string;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/ChangePasswordPanel.tsx
2
+ //
3
+ // 2026-10-08 -- change the wallet password: old password, new password, confirmation. Host-independent: the host supplies the call that
4
+ // re-encrypts the vault (the extension sends merit/vault/changePassword to its worker, which checks the old password again).
5
+ 'use client';
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { formKitStyle } from '@sponsorcoin/spcoin-common/styles';
8
+ import { useState } from 'react';
9
+ import { MIN_WALLET_PASSWORD_LENGTH } from './session/walletSession';
10
+ const box = formKitStyle.box(12);
11
+ const field = formKitStyle.input;
12
+ const primary = formKitStyle.primary;
13
+ /**
14
+ * 2026-10-11 (docs/design/accountAuthDesign.txt 14.3, item V5): `note` is the host's own small print (the web's development keystore says that every account is re-encrypted); `title` and `confirmLabel`
15
+ * let a host keep its wording. The new password must also differ from the current one.
16
+ */
17
+ export default function ChangePasswordPanel({ changePassword, onDone, note, title = 'Change password', confirmLabel = 'Change password' }) {
18
+ const [oldPw, setOldPw] = useState('');
19
+ const [newPw, setNewPw] = useState('');
20
+ const [confirm, setConfirm] = useState('');
21
+ const [error, setError] = useState('');
22
+ const [busy, setBusy] = useState(false);
23
+ const [changed, setChanged] = useState(false);
24
+ if (changed) {
25
+ return (_jsxs("div", { id: "WALLET_PASSWORD_CHANGED", style: box, children: [_jsx("p", { style: formKitStyle.plain, children: "Your password was changed." }), _jsx("button", { type: "button", style: primary, onClick: onDone, children: "Done" })] }));
26
+ }
27
+ return (_jsxs("form", { id: "WALLET_CHANGE_PASSWORD", style: box, onSubmit: (e) => {
28
+ e.preventDefault();
29
+ if (newPw.length < MIN_WALLET_PASSWORD_LENGTH)
30
+ return setError('Password must be at least ' + MIN_WALLET_PASSWORD_LENGTH + ' characters.');
31
+ if (newPw !== confirm)
32
+ return setError('Passwords do not match.');
33
+ if (newPw === oldPw)
34
+ return setError('The new password must be different from the current password.');
35
+ setBusy(true);
36
+ setError('');
37
+ changePassword(oldPw, newPw)
38
+ .then(() => setChanged(true))
39
+ .catch((err) => setError(err instanceof Error ? err.message : 'The password could not be changed.'))
40
+ .finally(() => setBusy(false));
41
+ }, children: [_jsx("p", { style: formKitStyle.heading, children: title }), _jsx("input", { type: "password", autoComplete: "current-password", placeholder: "Current password", value: oldPw, onChange: (e) => setOldPw(e.target.value), style: field }), _jsx("input", { type: "password", autoComplete: "new-password", placeholder: "New password", value: newPw, onChange: (e) => setNewPw(e.target.value), style: field }), _jsx("input", { type: "password", autoComplete: "new-password", placeholder: "Confirm new password", value: confirm, onChange: (e) => setConfirm(e.target.value), style: field }), error && _jsx("p", { style: formKitStyle.error, children: error }), _jsx("button", { type: "submit", disabled: busy || !oldPw, style: formKitStyle.primaryDim(busy || !oldPw), children: busy ? 'Changing…' : confirmLabel }), note && _jsx("p", { style: formKitStyle.note, children: note })] }));
42
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { MessageAccountEntry, MessageTokenEntry } from '@sponsorcoin/spcoin-common/context';
3
+ export interface ConnectedMessagePanelProps {
4
+ renderAccountRow?: (entry: MessageAccountEntry, index: number) => React.ReactNode;
5
+ renderTokenRow?: (entry: MessageTokenEntry, index: number) => React.ReactNode;
6
+ }
7
+ export default function ConnectedMessagePanel({ renderAccountRow, renderTokenRow }: ConnectedMessagePanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/ConnectedMessagePanel.tsx
2
+ //
3
+ // 2026-10-08 (docs/meritWalletNpmDesignToDo.txt, row 8 / S2b-4b) -- the message panel (MESSAGE_PANEL), wired to the exchange engine, written
4
+ // once for both hosts. The card itself is spcoin-panels' MessagePanelReal; what the web app's components/views/MessagePanel.tsx added was
5
+ // reading the current error message from the exchange context and filling the account / token row slots. This is that wiring, moved: the
6
+ // message comes from the engine's useExchangeContext (the same field the web hook useErrorMessage reads; the hook's only extras were a
7
+ // dedupe on write and a debug trace, neither used by a reader).
8
+ //
9
+ // Rows: a host may pass its own renderers (the web app passes rows built on its click-through account pill and token logo). Without them
10
+ // the package renders plain rows: the token row is the web app's MessageTokenRow, unchanged (it only uses the package TokenLogo); the
11
+ // account row is a simple avatar + "ROLE: symbol | name" + address line, since the web pill's click behaviour is web-only.
12
+ 'use client';
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { messageRowStyle } from '@sponsorcoin/spcoin-common/styles';
15
+ import { useSyncExternalStore } from 'react';
16
+ import { useExchangeContext, stepPanelContentStore } from '@sponsorcoin/spcoin-exchange-engine';
17
+ import { MessageAccountRow, TokenLogo } from '@sponsorcoin/spcoin-panels';
18
+ import { MessagePanelReal } from './panels';
19
+ import { pendingApprovalMessageStore } from './approval/pendingApprovalMessageStore';
20
+ /** The web app's MessageTokenRow, unchanged. */
21
+ function DefaultTokenRow({ entry }) {
22
+ return (_jsxs("div", { style: messageRowStyle.tokenColumn, children: [_jsxs("div", { style: messageRowStyle.line, children: [_jsx(TokenLogo, { tokenContract: entry.token, className: "", style: messageRowStyle.tokenLogo }), _jsxs("span", { style: messageRowStyle.label, children: [_jsxs("span", { style: messageRowStyle.role, children: [entry.label, ":"] }), ' ', [entry.token.symbol, entry.token.name].filter(Boolean).join(': ')] })] }), entry.detail && _jsx("div", { style: messageRowStyle.detail, children: entry.detail })] }));
23
+ }
24
+ export default function ConnectedMessagePanel({ renderAccountRow, renderTokenRow }) {
25
+ const { errorMessage } = useExchangeContext();
26
+ // 2026-10-29: present only while a Merit-authorized write is waiting on a person —
27
+ // useMeritApprovalMessagePanel.ts (mounted once in MeritWallet.tsx) publishes it here rather
28
+ // than as a prop, since this component is mounted in more than one place — see that store's own
29
+ // doc comment for why.
30
+ const pendingApproval = useSyncExternalStore(pendingApprovalMessageStore.subscribe, pendingApprovalMessageStore.getSnapshot, pendingApprovalMessageStore.getServerSnapshot);
31
+ // A step-through popup published for MESSAGE_PANEL (the Swap tab's Steps flow) replaces the normal message while it is up.
32
+ const stepContent = useSyncExternalStore(stepPanelContentStore.subscribe, stepPanelContentStore.getSnapshot, stepPanelContentStore.getServerSnapshot);
33
+ // A write waiting on a person (Approve / Reject, the password) always comes first: the step popup returns once it is answered.
34
+ if (stepContent && !pendingApproval)
35
+ return _jsx("div", { style: messageRowStyle.stepContent, children: stepContent });
36
+ return (_jsx(MessagePanelReal, { errorMessage: errorMessage, renderAccountRow: renderAccountRow ?? ((entry, i) => _jsx(MessageAccountRow, { entry: entry }, `${entry.role}-${i}`)), renderTokenRow: renderTokenRow ?? ((entry, i) => _jsx(DefaultTokenRow, { entry: entry }, `token-${i}`)), pendingApproval: pendingApproval }));
37
+ }
@@ -0,0 +1,15 @@
1
+ import type { NetworkElement } from '@sponsorcoin/spcoin-common/context';
2
+ /** A NetworkElement for a chain id straight from the registry (the default for previewing a chain other than the live one). */
3
+ export declare function networkElementFromRegistry(chainId: number): NetworkElement;
4
+ export interface LiveNetwork {
5
+ network: NetworkElement & Record<string, unknown>;
6
+ chainId: number;
7
+ }
8
+ /** Default live network: the exchange context's network, filled in from the registry the way the web app's useNetwork fills it from its helpers. */
9
+ export declare function useLiveNetworkFromContext(): LiveNetwork;
10
+ export interface ConnectedNetworkPanelProps {
11
+ onClose?: () => void;
12
+ /** Host hook for the live network (stable module-level function). Default: the exchange context filled from the registry. */
13
+ useLiveNetwork?: () => LiveNetwork;
14
+ }
15
+ export default function ConnectedNetworkPanel({ useLiveNetwork }: ConnectedNetworkPanelProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,118 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/ConnectedNetworkPanel.tsx
2
+ //
3
+ // 2026-10-08 (docs/meritWalletNpmDesignToDo.txt, row 8 / S2b-4b) -- the network detail overlay (NETWORK_PANEL), wired to the exchange engine,
4
+ // written once for both hosts. It is the web app's components/views/RadioOverlayPanels/NetworkPanel/index.tsx moved: same gates, same
5
+ // preview-then-live logic, same rows. Where the inputs come from is what changed, the MetaMask way (one network registry that every screen
6
+ // reads, like its NetworkController):
7
+ // - the preview store is the engine's (previewNetworkStore, moved there unchanged);
8
+ // - a chain's name, symbol, logo, explorer and RPC come from spcoin-feeds' network registry (getNetworkConfiguration);
9
+ // - the host may override how the live network and a previewed chain are resolved, and how the extra info.json fields are loaded: the web
10
+ // app does, so what it shows stays exactly what it showed (it still resolves names and symbols through its own helpers until those are
11
+ // rebased on the registry, a separate step: the two sources differ for Base, Polygon and Sepolia).
12
+ // A host that passes nothing gets the registry defaults, which is what the extension uses.
13
+ 'use client';
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { tokenRowClass, tokenRowStyle } from '@sponsorcoin/spcoin-common/styles';
16
+ import { useEffect, useMemo, useRef, useState } from 'react';
17
+ import { CopyBtn } from './TokenSlotPanels';
18
+ import { SP_COIN_DISPLAY } from '@sponsorcoin/spcoin-common/panels';
19
+ import { defaultStaticImage, previewNetworkStore, useExchangeContext, usePanelVisible, usePreviewNetworkChainId, } from '@sponsorcoin/spcoin-exchange-engine';
20
+ import { getNetworkConfiguration } from '@sponsorcoin/spcoin-feeds/networks';
21
+ import { getNetworkMetaData } from '@sponsorcoin/spcoin-panels';
22
+ import MetaDetailScreen from './account/MetaDetailScreen';
23
+ import { useWalletData } from './walletData';
24
+ /** A NetworkElement for a chain id straight from the registry (the default for previewing a chain other than the live one). */
25
+ export function networkElementFromRegistry(chainId) {
26
+ const cfg = getNetworkConfiguration(chainId);
27
+ return {
28
+ connected: false,
29
+ appChainId: 0,
30
+ chainId,
31
+ name: cfg?.name ?? '',
32
+ symbol: cfg?.symbol ?? '',
33
+ logoURL: cfg?.logoURL ?? '',
34
+ url: cfg?.explorerUrl ?? '',
35
+ rpcUrl: cfg?.rpcUrl ?? '',
36
+ };
37
+ }
38
+ /** Default live network: the exchange context's network, filled in from the registry the way the web app's useNetwork fills it from its helpers. */
39
+ export function useLiveNetworkFromContext() {
40
+ const { exchangeContext } = useExchangeContext();
41
+ const ctxNet = (exchangeContext?.apiCoreSyncedMembers?.network ?? {});
42
+ const chainId = ctxNet.appChainId || 0;
43
+ const cfg = getNetworkConfiguration(chainId);
44
+ const network = {
45
+ ...ctxNet,
46
+ chainId,
47
+ name: ctxNet.name || cfg?.name || '',
48
+ logoURL: ctxNet.logoURL || cfg?.logoURL || '',
49
+ url: ctxNet.url || cfg?.explorerUrl || '',
50
+ rpcUrl: ctxNet.rpcUrl || '',
51
+ connected: !!ctxNet.connected,
52
+ };
53
+ return { network, chainId };
54
+ }
55
+ export default function ConnectedNetworkPanel({ useLiveNetwork = useLiveNetworkFromContext }) {
56
+ const vNetworkPanel = usePanelVisible(SP_COIN_DISPLAY.NETWORK_PANEL);
57
+ const { resolveNetwork, loadNetworkInfo } = useWalletData();
58
+ const { network: liveNetwork, chainId: liveChainId } = useLiveNetwork();
59
+ const previewChainId = usePreviewNetworkChainId();
60
+ const isPreviewMode = previewChainId != null;
61
+ const previewNetwork = useMemo(() => (isPreviewMode ? (resolveNetwork ?? networkElementFromRegistry)(previewChainId) : undefined), [isPreviewMode, previewChainId, resolveNetwork]);
62
+ const network = previewNetwork ?? liveNetwork;
63
+ const chainId = isPreviewMode ? previewChainId : liveChainId;
64
+ // Self-heal the fields NetworkElement doesn't carry (website/description) from the network's own info.json.
65
+ const [info, setInfo] = useState(undefined);
66
+ useEffect(() => {
67
+ if (!vNetworkPanel || !chainId) {
68
+ setInfo(undefined);
69
+ return;
70
+ }
71
+ let cancelled = false;
72
+ const load = loadNetworkInfo
73
+ ? loadNetworkInfo(chainId)
74
+ : fetch(`/assets/blockchains/${chainId}/info.json`).then((res) => (res.ok ? res.json() : undefined));
75
+ load
76
+ .then((data) => {
77
+ if (!cancelled)
78
+ setInfo(data);
79
+ })
80
+ .catch(() => {
81
+ if (!cancelled)
82
+ setInfo(undefined);
83
+ });
84
+ return () => {
85
+ cancelled = true;
86
+ };
87
+ }, [vNetworkPanel, chainId, loadNetworkInfo]);
88
+ // Clear the preview once NETWORK_PANEL closes, so a stale preview doesn't linger for the next time it's opened.
89
+ const prevVisibleRef = useRef(false);
90
+ useEffect(() => {
91
+ const wasVisible = prevVisibleRef.current;
92
+ prevVisibleRef.current = vNetworkPanel;
93
+ if (!wasVisible || vNetworkPanel)
94
+ return;
95
+ previewNetworkStore.clear();
96
+ }, [vNetworkPanel]);
97
+ if (!vNetworkPanel)
98
+ return null;
99
+ if (!chainId) {
100
+ return (_jsx("div", { id: "NETWORK_PANEL", children: _jsxs("div", { className: tokenRowClass.empty, style: tokenRowStyle.text, children: [_jsx("p", { className: tokenRowClass.emptyTitle, children: "No network selected." }), _jsx("p", { className: tokenRowClass.emptyText, children: "Select a network to view its details." })] }) }));
101
+ }
102
+ const resolvedNetwork = { ...network, ...info };
103
+ const logoURL = (resolvedNetwork.logoURL ?? '').toString().trim();
104
+ const name = (resolvedNetwork.name ?? '').toString().trim();
105
+ const rows = getNetworkMetaData(resolvedNetwork).map((f) => {
106
+ if (!f.value)
107
+ return { label: f.label, value: 'N/A' };
108
+ if (f.kind === 'url') {
109
+ return {
110
+ label: f.label,
111
+ value: (_jsxs("span", { className: tokenRowClass.cell, children: [_jsx("a", { href: f.value, target: "_blank", rel: "noopener noreferrer", className: tokenRowClass.link, children: f.value }), _jsx(CopyBtn, { text: f.value })] })),
112
+ };
113
+ }
114
+ return { label: f.label, value: f.value };
115
+ });
116
+ // 2026-11-09 (owner): drawn by the shared read-only screen, the twin of the Account Details screen. Network logos are already complete, self-contained circular brand marks with real transparent padding, so no navy fill behind them.
117
+ return (_jsx(MetaDetailScreen, { screenId: "NETWORK_PANEL", logoFlag: SP_COIN_DISPLAY.NETWORK_LOGO, metaFlag: SP_COIN_DISPLAY.NETWORK_META_DATA, logoId: "NETWORK_LOGO", metaId: "NETWORK_META_DATA", logoSrc: logoURL || defaultStaticImage, logoAlt: name, toggleLabel: "Network Meta", imageKind: "network", rows: rows, plainLogo: true, fitImageShape: true }));
118
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ /**
3
+ * 2026-10-11 (docs/design/accountAuthDesign.txt 14.3, item V5): `warning` carries the host's wording for what is lost (the default says the wallet is removed from this device); `title` and `confirmLabel` keep a
4
+ * host's own words (the web's development keystore says "Remove Account"); `footnote` is optional small print under the buttons.
5
+ */
6
+ export default function DeleteWalletDialog({ confirmDelete, onClose, warning, title, confirmLabel, footnote }: {
7
+ confirmDelete(password: string): Promise<void>;
8
+ onClose(): void;
9
+ warning?: React.ReactNode;
10
+ title?: string;
11
+ confirmLabel?: string;
12
+ footnote?: string;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,74 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/DeleteWalletDialog.tsx
2
+ //
3
+ // 2026-10-08 -- the confirmation popup for deleting the wallet from this device: it asks for the wallet password and deletes only when the host says
4
+ // the password is right. Host-independent: the host supplies confirmDelete(password), which throws a readable message for a wrong password.
5
+ //
6
+ // 2026-10-22 (owner request): the submit button itself carries the whole state (see dialogStyle.deleteConfirmButton's own doc comment) -- blue
7
+ // "Password Required" while empty, still blue with the host's confirmLabel once something is typed (nothing here can know the password is RIGHT
8
+ // before the server says so, so typing alone never turns it green), a quick double red/blue flash on a wrong password then solid red with the
9
+ // server's own message for a few seconds before it reverts on its own, and green only once the server actually confirms the password and the
10
+ // delete succeeds. A wrong password is kept, not cleared (the same rule the login screen follows), so a typo can be fixed instead of retyped. An
11
+ // eye icon toggles the field between masked and plain text.
12
+ 'use client';
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { dialogStyle } from '@sponsorcoin/spcoin-common/styles';
15
+ import { Eye, EyeOff } from 'lucide-react';
16
+ import { useEffect, useState } from 'react';
17
+ import DialogPortal from './DialogPortal';
18
+ const FLASH_STEP_MS = 150;
19
+ const FLASH_STEPS = 4; // two full red/green cycles
20
+ const ERROR_SHOWN_MS = 5000; // how long the solid red state stays, after the flash settles
21
+ /**
22
+ * 2026-10-11 (docs/design/accountAuthDesign.txt 14.3, item V5): `warning` carries the host's wording for what is lost (the default says the wallet is removed from this device); `title` and `confirmLabel` keep a
23
+ * host's own words (the web's development keystore says "Remove Account"); `footnote` is optional small print under the buttons.
24
+ */
25
+ export default function DeleteWalletDialog({ confirmDelete, onClose, warning, title = 'Delete wallet', confirmLabel = 'Delete wallet', footnote }) {
26
+ const [password, setPassword] = useState('');
27
+ const [visible, setVisible] = useState(false);
28
+ const [error, setError] = useState('');
29
+ const [errorNonce, setErrorNonce] = useState(0);
30
+ const [flashOn, setFlashOn] = useState(false);
31
+ const [errorSettled, setErrorSettled] = useState(false);
32
+ const [busy, setBusy] = useState(false);
33
+ // only the server knows whether the password is right: green appears here, and only here, once confirmDelete actually resolves.
34
+ const [success, setSuccess] = useState(false);
35
+ // one failed submit runs the flash, then the solid error, then clears itself -- a SECOND failure (even with the identical message) must restart the
36
+ // whole sequence, which is why this keys off a nonce rather than the error text (two equal strings would not re-trigger a dependent effect).
37
+ useEffect(() => {
38
+ if (errorNonce === 0)
39
+ return;
40
+ setErrorSettled(false);
41
+ setFlashOn(true);
42
+ let step = 1;
43
+ const flashTimer = setInterval(() => {
44
+ step += 1;
45
+ setFlashOn((v) => !v);
46
+ if (step >= FLASH_STEPS) {
47
+ clearInterval(flashTimer);
48
+ setErrorSettled(true);
49
+ }
50
+ }, FLASH_STEP_MS);
51
+ const revertTimer = setTimeout(() => {
52
+ setError('');
53
+ setErrorSettled(false);
54
+ }, FLASH_STEPS * FLASH_STEP_MS + ERROR_SHOWN_MS);
55
+ return () => {
56
+ clearInterval(flashTimer);
57
+ clearTimeout(revertTimer);
58
+ };
59
+ }, [errorNonce]);
60
+ const variant = success ? 'success' : error ? (errorSettled ? 'error' : 'flash') : password ? 'typed' : 'empty';
61
+ const label = success ? 'Deleted' : busy ? 'Deleting…' : error ? error : password ? confirmLabel : 'Password Required';
62
+ return (_jsx(DialogPortal, { children: _jsx("div", { id: "DELETE_WALLET_DIALOG", role: "dialog", "aria-modal": "true", style: dialogStyle.backdrop, children: _jsxs("form", { style: dialogStyle.formCardDanger, onSubmit: (e) => {
63
+ e.preventDefault();
64
+ setBusy(true);
65
+ setError('');
66
+ confirmDelete(password)
67
+ .then(() => setSuccess(true))
68
+ .catch((err) => {
69
+ setError(err instanceof Error ? err.message : 'The wallet could not be deleted.');
70
+ setErrorNonce((n) => n + 1);
71
+ })
72
+ .finally(() => setBusy(false));
73
+ }, children: [_jsx("p", { style: dialogStyle.title, children: title }), _jsx("p", { style: dialogStyle.warning, children: warning ?? 'This deletes the wallet and all its accounts from this device. You can only get them back with your Secret Recovery Phrase (imported accounts need their private keys).' }), _jsxs("div", { style: dialogStyle.inputWrap, children: [_jsx("input", { type: visible ? 'text' : 'password', autoFocus: true, autoComplete: "current-password", placeholder: "Enter your password to confirm", value: password, onChange: (e) => setPassword(e.target.value), style: dialogStyle.input }), _jsx("button", { type: "button", onClick: () => setVisible((v) => !v), "aria-label": visible ? 'Hide password' : 'Show password', title: visible ? 'Hide password' : 'Show password', style: dialogStyle.eyeButton, children: visible ? _jsx(EyeOff, { size: 16 }) : _jsx(Eye, { size: 16 }) })] }), _jsx("button", { type: "submit", disabled: busy || !password, style: dialogStyle.deleteConfirmButton(variant, flashOn, busy), children: label }), _jsx("button", { type: "button", onClick: onClose, style: dialogStyle.cancelButton, children: "Cancel" }), footnote && _jsx("p", { style: dialogStyle.footnote, children: footnote })] }) }) }));
74
+ }
@@ -0,0 +1,3 @@
1
+ export default function DialogPortal({ children }: {
2
+ children: React.ReactNode;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ // File: node_source/meritWallet/packages/@sponsorcoin/merit-wallet/src/DialogPortal.tsx
2
+ //
3
+ // 2026-10-22 (owner report: "the Delete Permanently button does not work"). Every full-screen confirmation dialog (DeleteWalletDialog, PasswordPromptDialog, the Reset Password card in
4
+ // WalletSessionDialogs) is `position: fixed; inset: 0` drawn deep inside MeritWallet's own tree. The web app's floating wallet positions itself with a CSS `transform` (SpCoinWalletPopup.tsx's
5
+ // drag positioning) — a plain CSS rule then reparents `position: fixed` to THAT transformed ancestor instead of the real viewport, so the dialog's "full screen" backdrop no longer actually
6
+ // covers the screen, and the Config tab's own scrollable content painted OVER it, catching every click meant for the dialog's buttons (confirmed with document.elementFromPoint at the button's
7
+ // own pixel: it resolved to the Config panel, never the dialog, even on a forced click). Escaping to the platform's portal target (platform/platform.ts's portalContainer — document.body for
8
+ // every real DOM host) fixes it for every wallet layout mode and every host; this file itself touches no device API directly (test/platformBoundary.test.mjs), only the platform interface.
9
+ 'use client';
10
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
+ import { createPortal } from 'react-dom';
12
+ import { usePlatform } from './platform/platform';
13
+ export default function DialogPortal({ children }) {
14
+ const container = usePlatform().portalContainer();
15
+ // No portal target (a host with no such nesting problem, or none supplied): render in place, same as before this fix existed.
16
+ if (!container)
17
+ return _jsx(_Fragment, { children: children });
18
+ return createPortal(children, container);
19
+ }