@stridge/kit 0.1.0-alpha.6 → 0.1.0-alpha.60

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 (597) hide show
  1. package/README.md +22 -6
  2. package/dist/KitProvider.d.ts +61 -0
  3. package/dist/KitProvider.js +1 -1
  4. package/dist/_internal/activity/driver/index.d.ts +3 -0
  5. package/dist/_internal/activity/driver/index.js +1 -0
  6. package/dist/_internal/deposit/driver/index.d.ts +2 -2
  7. package/dist/_internal/drivers/stridge/index.d.ts +4 -2
  8. package/dist/_internal/drivers/stridge/index.js +1 -1
  9. package/dist/_internal/drivers/stridge-mock/index.d.ts +2 -1
  10. package/dist/_internal/drivers/stridge-mock/index.js +1 -1
  11. package/dist/_internal/withdraw/driver/index.d.ts +2 -2
  12. package/dist/activity/compound/index.d.ts +19 -0
  13. package/dist/activity/compound/index.js +1 -0
  14. package/dist/activity/dialog/index.d.ts +4 -0
  15. package/dist/activity/dialog/index.js +1 -0
  16. package/dist/activity/widgets/index.d.ts +5 -0
  17. package/dist/activity/widgets/index.js +1 -0
  18. package/dist/deposit/compound/index.d.ts +22 -15
  19. package/dist/deposit/compound/index.js +1 -1
  20. package/dist/deposit/dialog/index.d.ts +2 -1
  21. package/dist/deposit/widgets/index.d.ts +16 -0
  22. package/dist/deposit/widgets/index.js +1 -0
  23. package/dist/drivers/stridge/catalog.d.ts +54 -0
  24. package/dist/drivers/stridge/catalog.js +1 -0
  25. package/dist/drivers/stridge/createStridgeActivityDriver.d.ts +44 -0
  26. package/dist/drivers/stridge/createStridgeActivityDriver.js +1 -0
  27. package/dist/drivers/stridge/createStridgeDepositDriver.d.ts +10 -1
  28. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  29. package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +37 -14
  30. package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
  31. package/dist/drivers/stridge/internal/ensureWalletChain.js +1 -0
  32. package/dist/drivers/stridge/internal/pollOnce.js +1 -1
  33. package/dist/drivers/stridge/internal/resolveAddEthereumChain.js +1 -0
  34. package/dist/drivers/stridge/internal/retry.js +1 -0
  35. package/dist/drivers/stridge/internal/supportedChains.js +1 -0
  36. package/dist/drivers/stridge/types.d.ts +20 -14
  37. package/dist/drivers/stridge/types.js +1 -1
  38. package/dist/drivers/stridge/wagmiSigner.js +1 -1
  39. package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.d.ts +44 -0
  40. package/dist/drivers/stridge-mock/createStridgeMockActivityDriver.js +1 -0
  41. package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +2 -2
  42. package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
  43. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +15 -3
  44. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
  45. package/dist/drivers/stridge-mock/fixtures.d.ts +14 -12
  46. package/dist/drivers/stridge-mock/fixtures.js +1 -1
  47. package/dist/events/bus/createBus.d.ts +26 -0
  48. package/dist/events/bus/createBus.js +1 -0
  49. package/dist/events/bus/flowIdRegistry.d.ts +17 -0
  50. package/dist/events/bus/flowIdRegistry.js +1 -0
  51. package/dist/events/bus/index.js +1 -0
  52. package/dist/events/bus/metadata.js +1 -0
  53. package/dist/events/context.js +1 -0
  54. package/dist/events/emit/index.js +1 -0
  55. package/dist/events/emit/mapFailure.js +1 -0
  56. package/dist/events/emit/useActivityEmissions.js +1 -0
  57. package/dist/events/emit/useDepositEmissions.js +1 -0
  58. package/dist/events/emit/useKitEmitter.js +1 -0
  59. package/dist/events/emit/useWithdrawEmissions.js +1 -0
  60. package/dist/events/hooks/index.d.ts +6 -0
  61. package/dist/events/hooks/index.js +1 -0
  62. package/dist/events/hooks/useCurrentFlowId.d.ts +6 -0
  63. package/dist/events/hooks/useCurrentFlowId.js +1 -0
  64. package/dist/events/hooks/useStableHandler.js +1 -0
  65. package/dist/events/hooks/useStridgeEvent.d.ts +9 -0
  66. package/dist/events/hooks/useStridgeEvent.js +1 -0
  67. package/dist/events/hooks/useStridgeEventBus.d.ts +34 -0
  68. package/dist/events/hooks/useStridgeEventBus.js +1 -0
  69. package/dist/events/hooks/useStridgeEvents.d.ts +7 -0
  70. package/dist/events/hooks/useStridgeEvents.js +1 -0
  71. package/dist/events/hooks/useStridgeFlowEvent.d.ts +8 -0
  72. package/dist/events/hooks/useStridgeFlowEvent.js +1 -0
  73. package/dist/events/hooks/useStridgeFlowEvents.d.ts +6 -0
  74. package/dist/events/hooks/useStridgeFlowEvents.js +1 -0
  75. package/dist/events/index.d.ts +17 -0
  76. package/dist/events/index.js +1 -0
  77. package/dist/events/publish.js +1 -0
  78. package/dist/events/redact.d.ts +34 -0
  79. package/dist/events/redact.js +1 -0
  80. package/dist/events/types/activity.d.ts +53 -0
  81. package/dist/events/types/deposit.d.ts +235 -0
  82. package/dist/events/types/envelope.d.ts +145 -0
  83. package/dist/events/types/index.d.ts +32 -0
  84. package/dist/events/types/kit.d.ts +23 -0
  85. package/dist/events/types/withdraw.d.ts +150 -0
  86. package/dist/flows/activity/compound/ActivityFlow.d.ts +46 -0
  87. package/dist/flows/activity/compound/ActivityFlow.js +1 -0
  88. package/dist/flows/activity/compound/components/Boundary.d.ts +29 -0
  89. package/dist/flows/activity/compound/components/Boundary.js +1 -0
  90. package/dist/flows/activity/compound/components/Steps.d.ts +24 -0
  91. package/dist/flows/activity/compound/components/Steps.js +1 -0
  92. package/dist/flows/activity/dialog/ActivityDialog.d.ts +55 -0
  93. package/dist/flows/activity/dialog/ActivityDialog.js +1 -0
  94. package/dist/flows/activity/dialog/ActivityFlowBoundary.d.ts +1 -0
  95. package/dist/flows/activity/dialog/ActivityFlowBoundary.js +1 -0
  96. package/dist/flows/activity/driver/context.d.ts +38 -0
  97. package/dist/flows/activity/driver/context.js +1 -0
  98. package/dist/flows/activity/driver/types.d.ts +58 -0
  99. package/dist/flows/activity/orchestrator/controller.d.ts +11 -0
  100. package/dist/flows/activity/orchestrator/controller.js +1 -0
  101. package/dist/flows/activity/orchestrator/index.d.ts +4 -0
  102. package/dist/flows/activity/orchestrator/index.js +1 -0
  103. package/dist/flows/activity/orchestrator/reducer.d.ts +1 -0
  104. package/dist/flows/activity/orchestrator/reducer.js +1 -0
  105. package/dist/flows/activity/orchestrator/types.d.ts +71 -0
  106. package/dist/flows/activity/orchestrator/useActivity.d.ts +94 -0
  107. package/dist/flows/activity/orchestrator/useActivity.js +1 -0
  108. package/dist/flows/activity/widgets/ActivityDetail.d.ts +41 -0
  109. package/dist/flows/activity/widgets/ActivityDetail.js +1 -0
  110. package/dist/flows/activity/widgets/ActivityList.d.ts +38 -0
  111. package/dist/flows/activity/widgets/ActivityList.js +1 -0
  112. package/dist/flows/activity/widgets/useStandaloneActivitySource.js +1 -0
  113. package/dist/flows/deposit/bindings/DepositBindings.d.ts +87 -0
  114. package/dist/flows/deposit/bindings/DepositBindings.js +1 -0
  115. package/dist/flows/deposit/bindings/index.d.ts +1 -0
  116. package/dist/flows/deposit/bindings/index.js +1 -0
  117. package/dist/flows/deposit/dialog/DepositBootstrapErrorState.js +1 -1
  118. package/dist/flows/deposit/dialog/DepositDialog.d.ts +26 -79
  119. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  120. package/dist/flows/deposit/dialog/WalletRequiredState.js +1 -0
  121. package/dist/flows/deposit/dialog/WalletRequiredState.styles.js +1 -0
  122. package/dist/flows/deposit/driver/payloads.d.ts +52 -5
  123. package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.d.ts +2 -0
  124. package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.js +1 -1
  125. package/dist/flows/deposit/driver/transformers/index.d.ts +1 -0
  126. package/dist/flows/deposit/driver/transformers/quoteToPayload.d.ts +2 -0
  127. package/dist/flows/deposit/driver/transformers/settlementToPayload.d.ts +25 -0
  128. package/dist/flows/deposit/driver/transformers/settlementToPayload.js +1 -1
  129. package/dist/flows/deposit/driver/transformers/startToAddressesPayload.d.ts +2 -0
  130. package/dist/flows/deposit/driver/transformers/startToAddressesPayload.js +1 -1
  131. package/dist/flows/deposit/driver/transformers/startToBrandPayload.d.ts +1 -0
  132. package/dist/flows/deposit/driver/transformers/startToTargetPayload.d.ts +2 -0
  133. package/dist/flows/deposit/driver/transformers/startToTargetPayload.js +1 -1
  134. package/dist/flows/deposit/driver/transformers/walletAddressToWalletPayload.d.ts +1 -0
  135. package/dist/flows/deposit/driver/types.d.ts +37 -4
  136. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  137. package/dist/flows/deposit/orchestrator/index.d.ts +5 -0
  138. package/dist/flows/deposit/orchestrator/reducer.d.ts +1 -0
  139. package/dist/flows/deposit/orchestrator/reducer.js +1 -1
  140. package/dist/flows/deposit/orchestrator/types.d.ts +228 -7
  141. package/dist/flows/deposit/orchestrator/useDeposit.d.ts +45 -1
  142. package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
  143. package/dist/flows/deposit/shared/cash.d.ts +20 -0
  144. package/dist/flows/deposit/shared/cash.js +1 -0
  145. package/dist/flows/deposit/widgets/activity/DepositActivityDetail.d.ts +40 -0
  146. package/dist/flows/deposit/widgets/activity/DepositActivityDetail.js +1 -0
  147. package/dist/flows/deposit/widgets/activity/DepositActivityList.d.ts +38 -0
  148. package/dist/flows/deposit/widgets/activity/DepositActivityList.js +1 -0
  149. package/dist/flows/deposit/widgets/activity/index.d.ts +2 -0
  150. package/dist/flows/deposit/widgets/activity/index.js +1 -0
  151. package/dist/flows/deposit/widgets/activity/useDepositActivitySource.js +1 -0
  152. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +32 -5
  153. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  154. package/dist/flows/deposit/widgets/amount-entry/footerIntent.js +1 -0
  155. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.d.ts +24 -4
  156. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
  157. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.d.ts +71 -0
  158. package/dist/flows/deposit/widgets/cash-amount-entry/CashAmountEntry.js +1 -0
  159. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.d.ts +69 -0
  160. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.js +1 -0
  161. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.d.ts +16 -0
  162. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.slots.js +1 -0
  163. package/dist/flows/deposit/widgets/cash-amount-entry/compound/CashAmountEntry.styles.js +1 -0
  164. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.d.ts +13 -0
  165. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/HeroLabel.js +1 -0
  166. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.d.ts +18 -0
  167. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/MethodChip.js +1 -0
  168. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.d.ts +14 -0
  169. package/dist/flows/deposit/widgets/cash-amount-entry/compound/components/ReceiveChip.js +1 -0
  170. package/dist/flows/deposit/widgets/cash-amount-entry/compound/context.js +1 -0
  171. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.d.ts +3 -0
  172. package/dist/flows/deposit/widgets/cash-amount-entry/compound/index.js +1 -0
  173. package/dist/flows/deposit/widgets/cash-amount-entry/compound/types.d.ts +42 -0
  174. package/dist/flows/deposit/widgets/cash-amount-entry/index.d.ts +1 -0
  175. package/dist/flows/deposit/widgets/cash-amount-entry/index.js +1 -0
  176. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.d.ts +63 -0
  177. package/dist/flows/deposit/widgets/cash-confirm/CashConfirm.js +1 -0
  178. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.d.ts +54 -0
  179. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.js +1 -0
  180. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.d.ts +33 -0
  181. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.slots.js +1 -0
  182. package/dist/flows/deposit/widgets/cash-confirm/compound/CashConfirm.styles.js +1 -0
  183. package/dist/flows/deposit/widgets/cash-confirm/compound/cashConfirmDimensions.js +1 -0
  184. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.d.ts +15 -0
  185. package/dist/flows/deposit/widgets/cash-confirm/compound/components/ApplePayBody.js +1 -0
  186. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.d.ts +22 -0
  187. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Body.js +1 -0
  188. package/dist/flows/deposit/widgets/cash-confirm/compound/components/BodyLabel.js +1 -0
  189. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.d.ts +16 -0
  190. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardBody.js +1 -0
  191. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.icons.js +1 -0
  192. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.js +1 -0
  193. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.keys.js +1 -0
  194. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.state.js +1 -0
  195. package/dist/flows/deposit/widgets/cash-confirm/compound/components/CardInputRow.styles.js +1 -0
  196. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.d.ts +16 -0
  197. package/dist/flows/deposit/widgets/cash-confirm/compound/components/GooglePayBody.js +1 -0
  198. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.d.ts +21 -0
  199. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Header.js +1 -0
  200. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.d.ts +17 -0
  201. package/dist/flows/deposit/widgets/cash-confirm/compound/components/Summary.js +1 -0
  202. package/dist/flows/deposit/widgets/cash-confirm/compound/components/cardFormat.js +1 -0
  203. package/dist/flows/deposit/widgets/cash-confirm/compound/context.js +1 -0
  204. package/dist/flows/deposit/widgets/cash-confirm/compound/index.d.ts +3 -0
  205. package/dist/flows/deposit/widgets/cash-confirm/compound/index.js +1 -0
  206. package/dist/flows/deposit/widgets/cash-confirm/compound/types.d.ts +66 -0
  207. package/dist/flows/deposit/widgets/cash-confirm/index.d.ts +1 -0
  208. package/dist/flows/deposit/widgets/cash-confirm/index.js +1 -0
  209. package/dist/flows/deposit/widgets/cash-confirm/mocks.js +1 -0
  210. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts +37 -4
  211. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
  212. package/dist/flows/deposit/widgets/deposit/Deposit.d.ts +39 -4
  213. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  214. package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +58 -1
  215. package/dist/flows/deposit/widgets/deposit/compound/Deposit.js +1 -1
  216. package/dist/flows/deposit/widgets/deposit/compound/Deposit.slots.d.ts +6 -0
  217. package/dist/flows/deposit/widgets/deposit/compound/Deposit.slots.js +1 -1
  218. package/dist/flows/deposit/widgets/deposit/compound/Deposit.styles.js +1 -1
  219. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts +29 -0
  220. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.js +1 -0
  221. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.d.ts +28 -0
  222. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -0
  223. package/dist/flows/deposit/widgets/deposit/compound/components/Header.d.ts +11 -0
  224. package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
  225. package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +7 -0
  226. package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
  227. package/dist/flows/deposit/widgets/deposit/compound/components/MethodSection.d.ts +40 -0
  228. package/dist/flows/deposit/widgets/deposit/compound/components/MethodSection.js +1 -0
  229. package/dist/flows/deposit/widgets/deposit/compound/components/Methods.d.ts +16 -9
  230. package/dist/flows/deposit/widgets/deposit/compound/components/Methods.js +1 -1
  231. package/dist/flows/deposit/widgets/deposit/compound/components/Rail.d.ts +18 -0
  232. package/dist/flows/deposit/widgets/deposit/compound/components/Rail.js +1 -0
  233. package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.d.ts +43 -0
  234. package/dist/flows/deposit/widgets/deposit/compound/components/RailPicker.js +1 -0
  235. package/dist/flows/deposit/widgets/deposit/compound/components/Steps.d.ts +24 -0
  236. package/dist/flows/deposit/widgets/deposit/compound/components/Steps.js +1 -0
  237. package/dist/flows/deposit/widgets/deposit/compound/index.d.ts +2 -1
  238. package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +106 -4
  239. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +41 -1
  240. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
  241. package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
  242. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
  243. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
  244. package/dist/flows/deposit/widgets/deposit-status-banner/compound/types.d.ts +5 -5
  245. package/dist/flows/deposit/widgets/error-state/ErrorState.d.ts +39 -4
  246. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  247. package/dist/flows/deposit/widgets/processing-state/ProcessingState.d.ts +30 -4
  248. package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
  249. package/dist/flows/deposit/widgets/success-state/SuccessState.d.ts +38 -4
  250. package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
  251. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.d.ts +34 -3
  252. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
  253. package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.d.ts +1 -1
  254. package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.styles.js +1 -1
  255. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
  256. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +5 -2
  257. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
  258. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.d.ts +6 -0
  259. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.js +1 -1
  260. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
  261. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
  262. package/dist/flows/deposit/widgets/transfer-crypto/compound/types.d.ts +16 -2
  263. package/dist/flows/shared/transformers/computeQuoteAttrs.d.ts +1 -0
  264. package/dist/flows/shared/transformers/index.d.ts +1 -0
  265. package/dist/flows/shared/transformers/pickRelevantSettlement.d.ts +1 -0
  266. package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
  267. package/dist/flows/shared/transformers/testnets.js +1 -0
  268. package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
  269. package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
  270. package/dist/flows/withdraw/bindings/index.d.ts +1 -0
  271. package/dist/flows/withdraw/bindings/index.js +1 -0
  272. package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +44 -71
  273. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  274. package/dist/flows/withdraw/driver/dto.d.ts +8 -7
  275. package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
  276. package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
  277. package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
  278. package/dist/flows/withdraw/driver/types.d.ts +77 -14
  279. package/dist/flows/withdraw/orchestrator/controller.js +1 -1
  280. package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
  281. package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
  282. package/dist/flows/withdraw/orchestrator/types.d.ts +218 -35
  283. package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +36 -1
  284. package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
  285. package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.d.ts +39 -0
  286. package/dist/flows/withdraw/widgets/activity/WithdrawActivityDetail.js +1 -0
  287. package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.d.ts +36 -0
  288. package/dist/flows/withdraw/widgets/activity/WithdrawActivityList.js +1 -0
  289. package/dist/flows/withdraw/widgets/activity/index.d.ts +2 -0
  290. package/dist/flows/withdraw/widgets/activity/index.js +1 -0
  291. package/dist/flows/withdraw/widgets/activity/useWithdrawActivitySource.js +1 -0
  292. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.d.ts +60 -0
  293. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.js +1 -0
  294. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.d.ts +13 -0
  295. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.js +1 -0
  296. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.d.ts +29 -0
  297. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.js +1 -0
  298. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.d.ts +25 -0
  299. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.js +1 -0
  300. package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.d.ts +27 -0
  301. package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.js +1 -0
  302. package/dist/flows/withdraw/widgets/withdraw/compound/index.d.ts +3 -0
  303. package/dist/flows/withdraw/widgets/withdraw/compound/index.js +1 -0
  304. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.d.ts +45 -2
  305. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.js +1 -1
  306. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +32 -12
  307. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
  308. package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
  309. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Body.d.ts +7 -6
  310. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.d.ts +6 -1
  311. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.js +1 -1
  312. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
  313. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
  314. package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
  315. package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
  316. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +39 -3
  317. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
  318. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.d.ts +46 -2
  319. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
  320. package/dist/format/index.d.ts +2 -1
  321. package/dist/format/index.js +1 -1
  322. package/dist/i18n/index.d.ts +5 -4
  323. package/dist/i18n/index.js +1 -1
  324. package/dist/i18n/locales/ar.js +1 -1
  325. package/dist/i18n/locales/es.js +1 -1
  326. package/dist/i18n/locales/source-keys.d.ts +12 -0
  327. package/dist/i18n/locales/source-keys.js +0 -0
  328. package/dist/icons/index.d.ts +12 -1
  329. package/dist/icons/index.js +1 -1
  330. package/dist/index.d.ts +36 -11
  331. package/dist/index.js +1 -1
  332. package/dist/package.js +1 -1
  333. package/dist/scope/KitPortalScope.js +1 -1
  334. package/dist/scope/KitScope.d.ts +27 -1
  335. package/dist/scope/KitScope.js +1 -1
  336. package/dist/scope/context.d.ts +24 -1
  337. package/dist/scope/index.d.ts +1 -1
  338. package/dist/shared/attribution/Attribution.js +1 -0
  339. package/dist/shared/attribution/Attribution.slots.js +1 -0
  340. package/dist/shared/attribution/Attribution.styles.js +1 -0
  341. package/dist/shared/attribution/index.js +1 -0
  342. package/dist/shared/chains/index.d.ts +48 -29
  343. package/dist/shared/chains/index.js +1 -1
  344. package/dist/shared/constants/brand-intercom.js +1 -0
  345. package/dist/shared/cuer/Cuer.js +1 -1
  346. package/dist/shared/dialog/DialogShell.d.ts +21 -6
  347. package/dist/shared/dialog/DialogShell.js +1 -1
  348. package/dist/shared/dialog/Frame.js +1 -1
  349. package/dist/shared/dialog/LoadingState.js +1 -0
  350. package/dist/shared/dialog/LoadingState.styles.js +1 -0
  351. package/dist/shared/dialog/StepTransition.js +1 -1
  352. package/dist/shared/dialog/useDirectionalChevronTransform.js +1 -1
  353. package/dist/shared/driver/types.d.ts +4 -3
  354. package/dist/shared/format/formatSmartRelative.d.ts +25 -0
  355. package/dist/shared/format/formatSmartRelative.js +1 -0
  356. package/dist/shared/format/formatUsd.js +1 -1
  357. package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
  358. package/dist/shared/i18n/KitI18nProvider.js +1 -1
  359. package/dist/shared/i18n/createKitI18n.d.ts +79 -16
  360. package/dist/shared/i18n/createKitI18n.js +1 -1
  361. package/dist/shared/i18n/useLingui.d.ts +11 -3
  362. package/dist/shared/icons/ActivityIcon.d.ts +12 -0
  363. package/dist/shared/icons/ActivityIcon.js +1 -0
  364. package/dist/shared/icons/AmexIcon.d.ts +14 -0
  365. package/dist/shared/icons/AmexIcon.js +1 -0
  366. package/dist/shared/icons/ApplePayIcon.d.ts +15 -0
  367. package/dist/shared/icons/ApplePayIcon.js +1 -0
  368. package/dist/shared/icons/BitcoinIcon.d.ts +17 -0
  369. package/dist/shared/icons/BitcoinIcon.js +1 -0
  370. package/dist/shared/icons/CardIcon.d.ts +16 -0
  371. package/dist/shared/icons/CardIcon.js +1 -0
  372. package/dist/shared/icons/CashIcon.d.ts +16 -0
  373. package/dist/shared/icons/CashIcon.js +1 -0
  374. package/dist/shared/icons/DiscoverIcon.d.ts +14 -0
  375. package/dist/shared/icons/DiscoverIcon.js +1 -0
  376. package/dist/shared/icons/GooglePayIcon.d.ts +15 -0
  377. package/dist/shared/icons/GooglePayIcon.js +1 -0
  378. package/dist/shared/icons/LogoIcon.d.ts +13 -0
  379. package/dist/shared/icons/LogoIcon.js +1 -0
  380. package/dist/shared/icons/MastercardIcon.d.ts +16 -0
  381. package/dist/shared/icons/MastercardIcon.js +1 -0
  382. package/dist/shared/icons/VisaIcon.d.ts +15 -0
  383. package/dist/shared/icons/VisaIcon.js +1 -0
  384. package/dist/shared/merchant-link/MerchantLink.d.ts +1 -0
  385. package/dist/shared/merchant-link/MerchantLink.js +1 -0
  386. package/dist/shared/merchant-link/MerchantLinkButton.d.ts +1 -0
  387. package/dist/shared/merchant-link/MerchantLinkButton.js +1 -0
  388. package/dist/shared/merchant-link/index.d.ts +1 -0
  389. package/dist/shared/merchant-link/index.js +1 -0
  390. package/dist/shared/merchant-link/resolveMerchantLink.js +1 -0
  391. package/dist/shared/orchestrator/activityOpenInput.d.ts +21 -0
  392. package/dist/shared/orchestrator/createActivityReducers.js +1 -0
  393. package/dist/shared/orchestrator/index.d.ts +2 -0
  394. package/dist/shared/orchestrator/index.js +1 -1
  395. package/dist/shared/orchestrator/resolveActivityEntry.d.ts +1 -0
  396. package/dist/shared/orchestrator/resolveActivityEntry.js +1 -0
  397. package/dist/shared/orchestrator/toFailure.js +1 -1
  398. package/dist/shared/orchestrator/types.d.ts +8 -0
  399. package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
  400. package/dist/shared/presentation/index.js +1 -0
  401. package/dist/shared/presentation/types.d.ts +30 -0
  402. package/dist/shared/presentation/types.js +1 -0
  403. package/dist/shared/presentation/useResolvedSurfaceKind.js +1 -0
  404. package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
  405. package/dist/shared/support/SupportConfigContext.d.ts +1 -0
  406. package/dist/shared/support/SupportConfigContext.js +1 -0
  407. package/dist/shared/support/SupportLink.d.ts +1 -0
  408. package/dist/shared/support/SupportLink.js +1 -0
  409. package/dist/shared/support/SupportSpinner.d.ts +1 -0
  410. package/dist/shared/support/SupportSpinner.js +1 -0
  411. package/dist/shared/support/index.d.ts +2 -0
  412. package/dist/shared/support/index.js +1 -0
  413. package/dist/shared/support/intercom-loader.d.ts +17 -0
  414. package/dist/shared/support/intercom-loader.js +1 -0
  415. package/dist/shared/support/types.d.ts +43 -0
  416. package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
  417. package/dist/shared/support/useIntercomMerchantContext.js +1 -0
  418. package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
  419. package/dist/shared/support/useMerchantContext.d.ts +1 -0
  420. package/dist/shared/support/useMerchantContext.js +1 -0
  421. package/dist/shared/support/useSupportTrigger.js +1 -0
  422. package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
  423. package/dist/shared/terms/TermsConfigContext.js +1 -0
  424. package/dist/shared/terms/TermsLink.d.ts +1 -0
  425. package/dist/shared/terms/TermsLink.js +1 -0
  426. package/dist/shared/terms/index.d.ts +1 -0
  427. package/dist/shared/terms/index.js +1 -0
  428. package/dist/shared/terms/types.d.ts +43 -0
  429. package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.d.ts +52 -0
  430. package/dist/shared/ui/AdaptiveSurface/AdaptiveSurface.js +1 -0
  431. package/dist/shared/ui/AdaptiveSurface/index.d.ts +2 -0
  432. package/dist/shared/ui/AdaptiveSurface/index.js +1 -0
  433. package/dist/shared/ui/Card/Card.d.ts +12 -9
  434. package/dist/shared/ui/Card/Card.js +1 -1
  435. package/dist/shared/ui/Card/Card.styles.js +1 -1
  436. package/dist/shared/ui/Details/Details.d.ts +9 -1
  437. package/dist/shared/ui/Details/Details.styles.js +1 -1
  438. package/dist/shared/ui/Dialog/Dialog.d.ts +10 -8
  439. package/dist/shared/ui/Dialog/Dialog.js +1 -1
  440. package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
  441. package/dist/shared/ui/Drawer/Drawer.d.ts +135 -0
  442. package/dist/shared/ui/Drawer/Drawer.js +1 -0
  443. package/dist/shared/ui/Drawer/Drawer.slots.d.ts +19 -0
  444. package/dist/shared/ui/Drawer/Drawer.slots.js +1 -0
  445. package/dist/shared/ui/Drawer/Drawer.styles.js +1 -0
  446. package/dist/shared/ui/Drawer/index.d.ts +2 -0
  447. package/dist/shared/ui/Drawer/index.js +1 -0
  448. package/dist/shared/ui/Select/Select.js +1 -1
  449. package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +21 -8
  450. package/dist/shared/ui/SelectableTile/SelectableTile.js +1 -1
  451. package/dist/shared/ui/Steps/Steps.d.ts +52 -0
  452. package/dist/shared/ui/Steps/Steps.js +1 -0
  453. package/dist/shared/ui/Steps/Steps.slots.d.ts +7 -0
  454. package/dist/shared/ui/Steps/Steps.slots.js +1 -0
  455. package/dist/shared/ui/Steps/Steps.styles.js +1 -0
  456. package/dist/shared/ui/Steps/index.d.ts +2 -0
  457. package/dist/shared/ui/Steps/index.js +1 -0
  458. package/dist/shared/ui/Tabs/Tabs.d.ts +79 -0
  459. package/dist/shared/ui/Tabs/Tabs.js +1 -0
  460. package/dist/shared/ui/Tabs/Tabs.slots.d.ts +11 -0
  461. package/dist/shared/ui/Tabs/Tabs.slots.js +1 -0
  462. package/dist/shared/ui/Tabs/Tabs.styles.js +1 -0
  463. package/dist/shared/ui/Tabs/index.d.ts +2 -0
  464. package/dist/shared/ui/Tabs/index.js +1 -0
  465. package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
  466. package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
  467. package/dist/shared/ui/surfaceContext.d.ts +9 -0
  468. package/dist/shared/ui/surfaceContext.js +1 -0
  469. package/dist/shared/utils/assertNever.js +1 -0
  470. package/dist/shared/utils/logos/types.d.ts +1 -1
  471. package/dist/shared/utils/useDeepMemo.js +1 -0
  472. package/dist/shared/wallet/ConnectWalletContext.d.ts +17 -0
  473. package/dist/shared/wallet/ConnectWalletContext.js +1 -0
  474. package/dist/shared/widgets/activity/ActivityTrigger.js +1 -0
  475. package/dist/shared/widgets/activity/ActivityTrigger.styles.js +1 -0
  476. package/dist/shared/widgets/activity/adapters/settlementToWidgetProps.js +1 -0
  477. package/dist/shared/widgets/activity/compound/Activity.d.ts +95 -0
  478. package/dist/shared/widgets/activity/compound/Activity.js +1 -0
  479. package/dist/shared/widgets/activity/compound/Activity.slots.d.ts +22 -0
  480. package/dist/shared/widgets/activity/compound/Activity.slots.js +1 -0
  481. package/dist/shared/widgets/activity/compound/Activity.styles.js +1 -0
  482. package/dist/shared/widgets/activity/compound/ActivityDetail.d.ts +82 -0
  483. package/dist/shared/widgets/activity/compound/ActivityDetail.js +1 -0
  484. package/dist/shared/widgets/activity/compound/Row.slots.d.ts +21 -0
  485. package/dist/shared/widgets/activity/compound/Row.slots.js +1 -0
  486. package/dist/shared/widgets/activity/compound/Row.styles.js +1 -0
  487. package/dist/shared/widgets/activity/compound/components/ActivityHeader.d.ts +39 -0
  488. package/dist/shared/widgets/activity/compound/components/ActivityHeader.js +1 -0
  489. package/dist/shared/widgets/activity/compound/components/Empty.d.ts +15 -0
  490. package/dist/shared/widgets/activity/compound/components/Empty.js +1 -0
  491. package/dist/shared/widgets/activity/compound/components/ErrorView.d.ts +26 -0
  492. package/dist/shared/widgets/activity/compound/components/ErrorView.js +1 -0
  493. package/dist/shared/widgets/activity/compound/components/List.d.ts +23 -0
  494. package/dist/shared/widgets/activity/compound/components/List.js +1 -0
  495. package/dist/shared/widgets/activity/compound/components/Row.d.ts +51 -0
  496. package/dist/shared/widgets/activity/compound/components/Row.js +1 -0
  497. package/dist/shared/widgets/activity/compound/components/StatusPip.js +1 -0
  498. package/dist/shared/widgets/activity/compound/context.d.ts +95 -0
  499. package/dist/shared/widgets/activity/compound/context.js +1 -0
  500. package/dist/shared/widgets/activity/compound/index.d.ts +8 -0
  501. package/dist/shared/widgets/activity/compound/index.js +1 -0
  502. package/dist/shared/widgets/activity/index.js +1 -0
  503. package/dist/shared/widgets/activity/payloads.d.ts +108 -0
  504. package/dist/shared/widgets/activity/transformers/activityResponseToPayload.js +1 -0
  505. package/dist/shared/widgets/activity/transformers/resolveDirection.js +1 -0
  506. package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +10 -2
  507. package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
  508. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +6 -0
  509. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.js +1 -1
  510. package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
  511. package/dist/shared/widgets/amount-entry/compound/components/Details.d.ts +34 -0
  512. package/dist/shared/widgets/amount-entry/compound/components/Details.js +1 -0
  513. package/dist/shared/widgets/amount-entry/compound/components/Footer.d.ts +2 -1
  514. package/dist/shared/widgets/amount-entry/compound/components/Footer.js +1 -1
  515. package/dist/shared/widgets/amount-entry/compound/components/Header.d.ts +6 -1
  516. package/dist/shared/widgets/amount-entry/compound/components/Header.js +1 -1
  517. package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
  518. package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
  519. package/dist/shared/widgets/amount-entry/compound/components/Notice.d.ts +7 -0
  520. package/dist/shared/widgets/amount-entry/compound/components/Notice.js +1 -0
  521. package/dist/shared/widgets/amount-entry/compound/index.d.ts +1 -1
  522. package/dist/shared/widgets/amount-entry/compound/types.d.ts +63 -3
  523. package/dist/shared/widgets/asset-picker/compound/AssetPicker.d.ts +3 -0
  524. package/dist/shared/widgets/asset-picker/compound/AssetPicker.js +1 -1
  525. package/dist/shared/widgets/asset-picker/compound/AssetPicker.slots.d.ts +2 -0
  526. package/dist/shared/widgets/asset-picker/compound/AssetPicker.slots.js +1 -1
  527. package/dist/shared/widgets/asset-picker/compound/AssetPicker.styles.js +1 -1
  528. package/dist/shared/widgets/asset-picker/compound/components/Asset.d.ts +7 -1
  529. package/dist/shared/widgets/asset-picker/compound/components/Asset.js +1 -1
  530. package/dist/shared/widgets/asset-picker/compound/components/Empty.d.ts +15 -0
  531. package/dist/shared/widgets/asset-picker/compound/components/Empty.js +1 -0
  532. package/dist/shared/widgets/asset-picker/compound/components/Header.d.ts +6 -1
  533. package/dist/shared/widgets/asset-picker/compound/components/Header.js +1 -1
  534. package/dist/shared/widgets/asset-picker/compound/types.d.ts +15 -1
  535. package/dist/shared/widgets/confirm-transfer/compound/ConfirmTransfer.styles.js +1 -1
  536. package/dist/shared/widgets/confirm-transfer/compound/components/Breakdown.js +1 -1
  537. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
  538. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
  539. package/dist/shared/widgets/confirm-transfer/compound/components/QuoteTimer.js +1 -1
  540. package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
  541. package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
  542. package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +1 -1
  543. package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
  544. package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
  545. package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
  546. package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
  547. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
  548. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
  549. package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
  550. package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
  551. package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
  552. package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
  553. package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
  554. package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +14 -7
  555. package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
  556. package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
  557. package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
  558. package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
  559. package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
  560. package/dist/shared/widgets/processing-state/compound/types.d.ts +11 -29
  561. package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
  562. package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
  563. package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +1 -1
  564. package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
  565. package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
  566. package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
  567. package/dist/shared/widgets/success-state/compound/types.d.ts +5 -5
  568. package/dist/storage/context.d.ts +9 -1
  569. package/dist/storage/context.js +1 -1
  570. package/dist/storage/index.d.ts +1 -1
  571. package/dist/stridge/StridgeProvider.d.ts +187 -35
  572. package/dist/stridge/StridgeProvider.js +1 -1
  573. package/dist/stridge/depositOwner.js +1 -0
  574. package/dist/stridge/optionalWagmi.js +1 -0
  575. package/dist/stridge/stubs.js +1 -1
  576. package/dist/styles/index.css +607 -12
  577. package/dist/types.d.ts +7 -5
  578. package/dist/ui/index.d.ts +9 -1
  579. package/dist/ui/index.js +1 -1
  580. package/dist/version.d.ts +10 -0
  581. package/dist/version.js +1 -0
  582. package/dist/withdraw/compound/index.d.ts +11 -8
  583. package/dist/withdraw/compound/index.js +1 -1
  584. package/dist/withdraw/dialog/index.d.ts +4 -1
  585. package/dist/withdraw/widgets/index.d.ts +7 -0
  586. package/dist/withdraw/widgets/index.js +1 -0
  587. package/package.json +31 -7
  588. package/dist/_internal/deposit/widgets/index.d.ts +0 -11
  589. package/dist/_internal/deposit/widgets/index.js +0 -1
  590. package/dist/_internal/withdraw/widgets/index.d.ts +0 -5
  591. package/dist/_internal/withdraw/widgets/index.js +0 -1
  592. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.d.ts +0 -36
  593. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.js +0 -1
  594. package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
  595. package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
  596. package/dist/stridge/StridgeContext.d.ts +0 -29
  597. package/dist/stridge/StridgeContext.js +0 -1
@@ -1 +1 @@
1
- "use client";import{useDepositSnapshot as e}from"../driver/context.js";import{Trans as t}from"../../../shared/i18n/Trans.js";import{useLingui as n}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{useDepositActions as r}from"../orchestrator/controller.js";import{ChevronDownIcon as i}from"../../../shared/icons/ChevronDownIcon.js";import"../../../icons/index.js";import{Button as a}from"../../../shared/ui/Button/Button.js";import{Dialog as o}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Card as s}from"../../../shared/ui/Card/Card.js";import{Collapsible as c}from"../../../shared/ui/Collapsible/Collapsible.js";import"../../../shared/ui/Collapsible/index.js";import{text as l}from"../../../shared/ui/Text/Text.js";import"../../../ui/index.js";import{Frame as u}from"../../../shared/dialog/Frame.js";import{styles as d}from"./DepositBootstrapErrorState.styles.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import*as m from"@stylexjs/stylex";const h=process.env.NODE_ENV!==`production`;function g(){return p(`svg`,{"aria-hidden":!0,viewBox:`0 0 64 64`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,...m.props(d.heroRing),children:[f(`circle`,{cx:`32`,cy:`32`,r:`28`,strokeWidth:`2`,style:{stroke:`color-mix(in oklab, var(--stridge-kit-warning) 55%, transparent)`}}),f(`circle`,{cx:`32`,cy:`32`,r:`20`,style:{fill:`var(--stridge-kit-warning)`}}),f(`path`,{d:`M32 22V34`,strokeWidth:`2.8`,strokeLinecap:`round`,style:{stroke:`var(--stridge-kit-warning-foreground)`}}),f(`circle`,{cx:`32`,cy:`40.5`,r:`1.8`,style:{fill:`var(--stridge-kit-warning-foreground)`}})]})}function _(){let _=e(),{close:y}=r(),{_:b}=n(),x=(_.target.status===`error`?_.target.error:void 0)??(_.brand.status===`error`?_.brand.error:void 0)??(_.addresses.status===`error`?_.addresses.error:void 0),S=x?.name??`DepositBootstrapError`,C=x?.message??b({id:`3yd3IL`,message:`The deposit driver failed to load gateway configuration.`}),w=x?.stack;return p(u,{"data-stridge-slot":`deposit-bootstrap-error`,"data-testid":`deposit-bootstrap-error`,...m.props(d.root),children:[p(s.Header,{...m.props(d.header),children:[f(l.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,children:f(t,{id:`OLF0i7`,message:`Couldn't load deposit options`})}),f(o.CloseButton,{})]}),p(s.Body,{children:[p(`div`,{"data-stridge-slot":`deposit-bootstrap-error-hero`,...m.props(d.hero),children:[f(g,{}),f(l.span,{size:`lg`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,align:`center`,...m.props(d.heroHeadline),children:f(t,{id:`qQ5VJt`,message:`We can't reach the gateway right now`})}),f(l.span,{size:`sm`,leading:`normal`,align:`center`,color:`subdued`,...m.props(d.heroReason),children:f(t,{id:`02NghK`,message:`Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration.`})})]}),p(c,{"data-stridge-slot":`deposit-bootstrap-error-details`,...m.props(d.details),children:[p(c.Trigger,{render:f(`button`,{type:`button`}),"aria-label":b({id:`c6Bl9M`,message:`Toggle technical details`}),...m.props(d.detailsTrigger),children:[f(l.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`subdued`,children:f(t,{id:`69Gavs`,message:`Technical details`})}),f(i,{"aria-hidden":!0,...m.props(d.detailsChevron)})]}),f(c.Panel,{children:p(`div`,{...m.props(d.detailsPanel),children:[f(v,{label:b({id:`SlfejT`,message:`Error`}),value:S}),f(v,{label:b({id:`xDAtGP`,message:`Message`}),value:C}),h&&w?p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:f(t,{id:`P9fBwv`,message:`Stack`})}),f(`pre`,{...m.props(d.stack),children:w})]}):null]})})]})]}),f(s.Footer,{...m.props(d.footer),children:f(a,{variant:`default`,size:`cta`,onClick:y,"data-stridge-slot":`deposit-bootstrap-error-close`,...m.props(d.cta),children:f(t,{id:`yz7wBu`,message:`Close`})})})]})}function v({label:e,value:t}){return p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:e}),f(l.span,{size:`xs`,fontWeight:`normal`,leading:`normal`,...m.props(d.detailsValue),children:t})]})}export{_ as DepositBootstrapErrorState};
1
+ "use client";import{Trans as e}from"../../../shared/i18n/Trans.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{useDepositSnapshot as n}from"../driver/context.js";import{useDepositActions as r}from"../orchestrator/controller.js";import{ChevronDownIcon as i}from"../../../shared/icons/ChevronDownIcon.js";import"../../../icons/index.js";import{Button as a}from"../../../shared/ui/Button/Button.js";import{Dialog as o}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Card as s}from"../../../shared/ui/Card/Card.js";import{Collapsible as c}from"../../../shared/ui/Collapsible/Collapsible.js";import"../../../shared/ui/Collapsible/index.js";import{text as l}from"../../../shared/ui/Text/Text.js";import"../../../ui/index.js";import{Frame as u}from"../../../shared/dialog/Frame.js";import{styles as d}from"./DepositBootstrapErrorState.styles.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";import*as m from"@stylexjs/stylex";const h=process.env.NODE_ENV!==`production`;function g(){return p(`svg`,{"aria-hidden":!0,viewBox:`0 0 64 64`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,...m.props(d.heroRing),children:[f(`circle`,{cx:`32`,cy:`32`,r:`28`,strokeWidth:`2`,style:{stroke:`color-mix(in oklab, var(--stridge-kit-warning) 55%, transparent)`}}),f(`circle`,{cx:`32`,cy:`32`,r:`20`,style:{fill:`var(--stridge-kit-warning)`}}),f(`path`,{d:`M32 22V34`,strokeWidth:`2.8`,strokeLinecap:`round`,style:{stroke:`var(--stridge-kit-warning-foreground)`}}),f(`circle`,{cx:`32`,cy:`40.5`,r:`1.8`,style:{fill:`var(--stridge-kit-warning-foreground)`}})]})}function _(){let _=n(),{close:y}=r(),{_:b}=t(),x=(_.target.status===`error`?_.target.error:void 0)??(_.brand.status===`error`?_.brand.error:void 0)??(_.addresses.status===`error`?_.addresses.error:void 0),S=x?.name??`DepositBootstrapError`,C=x?.message??b({id:`3yd3IL`,message:`The deposit driver failed to load gateway configuration.`}),w=x?.stack;return p(u,{"data-stridge-slot":`deposit-bootstrap-error`,"data-testid":`deposit-bootstrap-error`,...m.props(d.root),children:[p(s.Header,{...m.props(d.header),children:[f(l.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,children:f(e,{id:`OLF0i7`,message:`Couldn't load deposit options`})}),f(o.CloseButton,{})]}),p(s.Body,{children:[p(`div`,{"data-stridge-slot":`deposit-bootstrap-error-hero`,...m.props(d.hero),children:[f(g,{}),f(l.span,{size:`lg`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,align:`center`,...m.props(d.heroHeadline),children:f(e,{id:`qQ5VJt`,message:`We can't reach the gateway right now`})}),f(l.span,{size:`sm`,leading:`normal`,align:`center`,color:`subdued`,...m.props(d.heroReason),children:f(e,{id:`02NghK`,message:`Close this dialog and try again in a moment. If the problem persists, double-check the gateway key on your integration.`})})]}),p(c,{"data-stridge-slot":`deposit-bootstrap-error-details`,...m.props(d.details),children:[p(c.Trigger,{render:f(`button`,{type:`button`}),"aria-label":b({id:`c6Bl9M`,message:`Toggle technical details`}),...m.props(d.detailsTrigger),children:[f(l.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,color:`subdued`,children:f(e,{id:`69Gavs`,message:`Technical details`})}),f(i,{"aria-hidden":!0,...m.props(d.detailsChevron)})]}),f(c.Panel,{children:p(`div`,{...m.props(d.detailsPanel),children:[f(v,{label:b({id:`SlfejT`,message:`Error`}),value:S}),f(v,{label:b({id:`xDAtGP`,message:`Message`}),value:C}),h&&w?p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:f(e,{id:`P9fBwv`,message:`Stack`})}),f(`pre`,{...m.props(d.stack),children:w})]}):null]})})]})]}),f(s.Footer,{...m.props(d.footer),children:f(a,{variant:`default`,size:`cta`,onClick:y,"data-stridge-slot":`deposit-bootstrap-error-close`,...m.props(d.cta),children:f(e,{id:`yz7wBu`,message:`Close`})})})]})}function v({label:e,value:t}){return p(`div`,{...m.props(d.detailsRow),children:[f(l.span,{size:`2xs`,fontWeight:`medium`,leading:`tight`,tracking:`widest`,transform:`uppercase`,color:`subdued`,children:e}),f(l.span,{size:`xs`,fontWeight:`normal`,leading:`normal`,...m.props(d.detailsValue),children:t})]})}export{_ as DepositBootstrapErrorState};
@@ -1,7 +1,4 @@
1
- import { TxRef } from "../../../shared/driver/types.js";
2
- import { BalanceItemPayload, QuotePayload, SettlementFailurePayload, SettlementPendingPayload, SettlementSuccessPayload } from "../driver/payloads.js";
3
- import { FailureInfo } from "../../../shared/orchestrator/types.js";
4
- import { DepositMethod, DepositState, DepositStateName, ResolvedOpenInput } from "../orchestrator/types.js";
1
+ import { Presentation } from "../../../shared/presentation/types.js";
5
2
  import { ErrorInfo } from "react";
6
3
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
4
 
@@ -12,23 +9,23 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
12
9
  * bound to the controller's `state.name !== "closed"`, so the dialog appears / disappears
13
10
  * automatically as descendants call `useDeposit().open()` / `.close()`.
14
11
  *
15
- * Each widget gates rendering on its own FSM state, so the dialog stacks them and only one
16
- * renders content per state. Skip the dialog entirely for fully custom UI — render against
17
- * `useDeposit()` / `useDepositState()` / `useDepositSnapshot()` directly.
12
+ * The dialog is a pure composition of compound parts `<Deposit.Boundary>` for crash
13
+ * recovery, `<Deposit.Guards>` for the wallet-required / bootstrap-fatal / bootstrap-loading
14
+ * cascade, `<Deposit.Steps>` for FSM-driven screen routing, and `<DepositStatusBanner />` for
15
+ * the inline settlement banner. Each piece is independently overrideable via the compound
16
+ * surface; this is the canonical shape integrators can copy verbatim.
18
17
  *
19
- * Three top-level callbacks (`onOpened`, `onClosed`, `onStepChanged`) describe the dialog as a
20
- * stateful component. The grouped `events={{ }}` prop carries the operational lifecycle —
21
- * user actions, async outcomes from the orchestrator, and settlement-entity transitions for
22
- * pending / succeeded / failed deposits.
18
+ * Lifecycle observability is delivered by the unified event bus exported from
19
+ * `@stridge/kit/events`. The dialog itself takes no `on*` callback props subscribe via
20
+ * `useStridgeFlowEvents` / `useStridgeEvents` (or the single-event variants) anywhere in
21
+ * the provider subtree.
23
22
  */
24
23
  declare function DepositDialog({
25
24
  container,
26
- onOpened,
27
- onClosed,
28
- onStepChanged,
25
+ metadata,
29
26
  onError,
30
- events
31
- }: DepositDialog.Props): _$react_jsx_runtime0.JSX.Element;
27
+ presentation
28
+ }?: DepositDialog.Props): _$react_jsx_runtime0.JSX.Element;
32
29
  declare namespace DepositDialog {
33
30
  interface Props {
34
31
  /**
@@ -37,76 +34,26 @@ declare namespace DepositDialog {
37
34
  * dialog's width, height, and backdrop to that rect.
38
35
  */
39
36
  container?: HTMLElement | null;
40
- /** Forwarded to the dialog's internal {@link GatewayKitBoundary} for crash reporting. */
41
- onError?: (error: Error, errorInfo: ErrorInfo) => void;
42
37
  /**
43
- * Fires once when the dialog transitions from `closed` to any open step. Receives the
44
- * resolved open input derived from the entry state.
38
+ * Consumer-attached metadata that rides along on every bus event emitted from this
39
+ * dialog's session. Snapshotted at `deposit.opened` and frozen for the session
40
+ * mid-flow prop changes are ignored to keep correlation consistent from `opened` to
41
+ * the terminal event. The kit does not validate or normalise the shape.
45
42
  */
46
- onOpened?: (input: ResolvedOpenInput) => void;
47
- /** Fires once when the dialog transitions back to `closed`. `atStep` is the last open step. */
48
- onClosed?: (atStep: DepositStateName) => void;
49
- /** Fires on every logical step transition. */
50
- onStepChanged?: (event: {
51
- from: DepositStateName;
52
- to: DepositStateName;
53
- ctx: GatewayContext | null;
54
- }) => void;
55
- /** Operational events — user actions, async outcomes, settlement-entity transitions. */
56
- events?: Events;
57
- }
58
- /**
59
- * Operational lifecycle hooks. Fire after the controller has acted (state machine has
60
- * transitioned, driver entity has settled), so payloads are guaranteed valid for the named
61
- * event.
62
- */
63
- interface Events {
64
- /** User picked a deposit method on the `Deposit` step. */
65
- onMethodSelected?: (method: DepositMethod) => void;
66
- /** User confirmed an asset on the `AssetPicker` step. The asset is the driver-shaped balance row. */
67
- onAssetSelected?: (asset: BalanceItemPayload) => void;
68
- /** User submitted an amount on the `AmountEntry` step. */
69
- onAmountSubmitted?: (amount: number) => void;
70
- /** User confirmed the deposit on the `ConfirmDeposit` step (wallet prompt is about to fire). */
71
- onDepositConfirmed?: () => void;
72
- /** User pressed Back on a non-root step. */
73
- onBackPressed?: (fromStep: DepositStateName) => void;
74
- /** Orchestrator requested a quote (`confirmDeposit` entered `loading` or `regenerating`). */
75
- onQuoteRequested?: (input: {
76
- asset: BalanceItemPayload;
77
- amount: number;
78
- }) => void;
79
- /** Orchestrator received a successful quote — fires when the driver's `quote` entity transitions to `ready`. */
80
- onQuoteResolved?: (quote: QuotePayload) => void;
81
- /** Quote fetch failed (FSM `confirmDeposit{phase: failed, recoverFrom: "quote"}`). */
82
- onQuoteFailed?: (failure: FailureInfo) => void;
83
- /** A quote silently expired and a regeneration started (no user interaction). */
84
- onQuoteExpired?: () => void;
85
- /** Wallet broadcast a deposit tx; the orchestrator transitioned into `processing`. */
86
- onDepositSubmitted?: (tx: TxRef) => void;
87
- /** User declined the wallet signature prompt; orchestrator regenerated the quote. */
88
- onSignatureDeclined?: () => void;
89
- /** Deposit submission failed for a non-rejection reason. */
90
- onSubmissionFailed?: (failure: FailureInfo) => void;
91
- /** The driver's `settlement` entity emitted a progressive pending update. */
92
- onProcessingProgress?: (update: SettlementPendingPayload) => void;
93
- /** Terminal success — settlement entity reached `ready{kind: "succeeded"}`. */
94
- onSucceeded?: (result: SettlementSuccessPayload) => void;
43
+ metadata?: Record<string, unknown>;
95
44
  /**
96
- * Terminal failure either a settlement failure (driver-emitted classification) or an
97
- * FSM-derived failure (quote / submission rejection escalated to the global error arm).
45
+ * Forwarded to the dialog's internal `<Deposit.Boundary>` for crash reporting. The
46
+ * boundary's `onReset` is wired automatically through `useDeposit().close()`.
98
47
  */
99
- onFailed?: (failure: SettlementFailurePayload | FailureInfo) => void;
48
+ onError?: (error: Error, errorInfo: ErrorInfo) => void;
100
49
  /**
101
- * Background `fetchActiveSettlement` probe surfaced a pending deposit the driver's
102
- * `settlement` entity transitioned from `idle` / `loading` straight to a pending payload.
50
+ * Per-dialog surface override. `"auto"` (default) renders a centred dialog on wide
51
+ * containers and a bottom-sheet drawer below the breakpoint; `"dialog"` / `"drawer"`
52
+ * force one surface. Pass `{ mode, breakpoint }` to tune the px threshold (default 600).
53
+ * Wins over the provider's `appearance.presentation`; omit to inherit it.
103
54
  */
104
- onPendingSnapshotDetected?: (snapshot: SettlementPendingPayload) => void;
55
+ presentation?: Presentation;
105
56
  }
106
57
  }
107
- /** Convenience union — the `ctx` payload on `onStepChanged`. */
108
- type GatewayContext = Exclude<DepositState, {
109
- name: "closed";
110
- }>["ctx"];
111
58
  //#endregion
112
59
  export { DepositDialog };
@@ -1 +1 @@
1
- "use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useDialogLifecycle as t}from"../../../shared/orchestrator/useDialogLifecycle.js";import"../../../shared/orchestrator/index.js";import{useControllerContext as n}from"../orchestrator/controller.js";import{Dialog as r}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{AmountEntry as i}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as a}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{ConfirmDeposit as o}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as s}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as c}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as l}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as u}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as d}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as f}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{StepTransition as p}from"../../../shared/dialog/StepTransition.js";import{GatewayKitBoundary as m}from"../../../shared/error-handling/components/GatewayKitBoundary.js";import"../../../shared/error-handling/index.js";import{DepositBootstrapErrorState as h}from"./DepositBootstrapErrorState.js";import{useRef as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=new Set([`deposit`,`assetPicker`,`amountEntry`,`confirmDeposit`,`transferCrypto`]);function b({container:t,onOpened:g,onClosed:b,onStepChanged:S,onError:C,events:w}){let{state:T,effectiveState:E,controller:D}=n(),O=e(),k=T.name!==`closed`;x(T,O.settlement,O.quote,{onOpened:g,onClosed:b,onStepChanged:S,events:w});let A=E,j=O.target.status===`error`&&y.has(A.name);return _(r,{open:k,onOpenChange:e=>{e||D.close()},children:_(r.Content,{container:t,children:v(m,{onError:C,onReset:D.close,children:[j?_(h,{}):v(p,{stateKey:A.name,children:[A.name===`deposit`?_(s,{}):null,A.name===`assetPicker`?_(a,{}):null,A.name===`amountEntry`?_(i,{}):null,A.name===`confirmDeposit`?_(o,{}):null,A.name===`transferCrypto`?_(f,{}):null,A.name===`processing`?_(u,{}):null,A.name===`success`?_(d,{}):null,A.name===`error`?_(l,{}):null]}),_(c,{})]})})})}function x(e,n,r,i){let a=g(i);a.current=i,t({state:e,settlement:n,quote:r,fireFsm:(e,t)=>S(e,t,a.current),fireSettlement:(e,t)=>T(e,t,a.current),fireQuote:(e,t)=>{t.status===`ready`&&e!==`ready`&&a.current.events?.onQuoteResolved?.(t.payload)}})}function S(e,t,n){let{onOpened:r,onClosed:i,onStepChanged:a,events:o}=n;if(e.name===t.name){t.name===`confirmDeposit`&&e.name===`confirmDeposit`&&w(e.ctx.phase,t.ctx.phase,t,o);return}e.name===`closed`&&t.name!==`closed`&&r?.(C(t)),e.name!==`closed`&&t.name===`closed`&&i?.(e.name),a?.({from:e.name,to:t.name,ctx:t.name===`closed`?null:t.ctx}),e.name===`deposit`&&t.name===`assetPicker`&&o?.onMethodSelected?.(`wallet`),e.name===`deposit`&&t.name===`transferCrypto`&&o?.onMethodSelected?.(`transfer`),e.name===`assetPicker`&&t.name===`amountEntry`&&o?.onAssetSelected?.(t.ctx.asset),e.name===`amountEntry`&&t.name===`confirmDeposit`&&o?.onAmountSubmitted?.(t.ctx.amount),t.name===`confirmDeposit`&&(e.name!==`confirmDeposit`||e.ctx.phase.kind!==t.ctx.phase.kind)&&w(e.name===`confirmDeposit`?e.ctx.phase:void 0,t.ctx.phase,t,o),e.name===`confirmDeposit`&&t.name===`processing`&&o?.onDepositSubmitted?.(t.ctx.tx),e.name!==`error`&&t.name===`error`&&t.ctx.failure&&(o?.onFailed?.(t.ctx.failure),(e.name===`confirmDeposit`?e.ctx.phase:void 0)?.kind===`submitting`&&o?.onSubmissionFailed?.(t.ctx.failure)),t.name!==`closed`&&e.name!==`closed`&&`backTarget`in e.ctx&&t.name===e.ctx.backTarget&&o?.onBackPressed?.(e.name)}function C(e){if(e.name!==`deposit`){if(e.name===`transferCrypto`)return{method:`transfer`};if(e.name===`assetPicker`)return{method:`wallet`};if(e.name===`amountEntry`||e.name===`confirmDeposit`)return{method:`wallet`,asset:e.ctx.asset};if(e.name===`processing`||e.name===`success`)return e.ctx.method===`transfer`?{method:`transfer`}:{method:`wallet`}}}function w(e,t,n,r){r&&e?.kind!==t.kind&&((t.kind===`loading`||t.kind===`regenerating`)&&(r.onQuoteRequested?.({asset:n.ctx.asset,amount:n.ctx.amount}),t.kind===`regenerating`&&(e?.kind===`submitting`?r.onSignatureDeclined?.():e?.kind===`ready`&&r.onQuoteExpired?.())),t.kind===`failed`&&r.onQuoteFailed?.(t.failure),t.kind===`submitting`&&r.onDepositConfirmed?.())}function T(e,t,n){if(t.status!==`ready`&&t.status!==`stale`)return;let r=t.payload,i=n.events;if(i){if(r.kind===`pending`){e===null?i.onPendingSnapshotDetected?.(r):i.onProcessingProgress?.(r);return}if(r.kind===`succeeded`){i.onSucceeded?.(r);return}r.kind===`failed`&&i.onFailed?.(r)}}export{b as DepositDialog};
1
+ "use client";import{useDepositSnapshot as e}from"../driver/context.js";import{useControllerContext as t}from"../orchestrator/controller.js";import{useDepositEmissions as n}from"../../../events/emit/useDepositEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as r}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{AdaptiveSurface as i}from"../../../shared/ui/AdaptiveSurface/AdaptiveSurface.js";import"../../../shared/ui/AdaptiveSurface/index.js";import{Deposit as a}from"../widgets/deposit/compound/Deposit.js";import"../widgets/deposit/compound/index.js";import{DepositActivityDetail as o}from"../widgets/activity/DepositActivityDetail.js";import{DepositActivityList as s}from"../widgets/activity/DepositActivityList.js";import"../widgets/activity/index.js";import{AmountEntry as c}from"../widgets/amount-entry/AmountEntry.js";import"../widgets/amount-entry/index.js";import{AssetPicker as l}from"../widgets/asset-picker/AssetPicker.js";import"../widgets/asset-picker/index.js";import{CashAmountEntry as u}from"../widgets/cash-amount-entry/CashAmountEntry.js";import"../widgets/cash-amount-entry/index.js";import{CashConfirm as d}from"../widgets/cash-confirm/CashConfirm.js";import"../widgets/cash-confirm/index.js";import{ConfirmDeposit as f}from"../widgets/confirm-deposit/ConfirmDeposit.js";import"../widgets/confirm-deposit/index.js";import{Deposit as p}from"../widgets/deposit/Deposit.js";import"../widgets/deposit/index.js";import{DepositStatusBanner as m}from"../widgets/deposit-status-banner/DepositStatusBanner.js";import"../widgets/deposit-status-banner/index.js";import{ErrorState as h}from"../widgets/error-state/ErrorState.js";import"../widgets/error-state/index.js";import{ProcessingState as g}from"../widgets/processing-state/ProcessingState.js";import"../widgets/processing-state/index.js";import{SuccessState as _}from"../widgets/success-state/SuccessState.js";import"../widgets/success-state/index.js";import{TransferCrypto as v}from"../widgets/transfer-crypto/TransferCrypto.js";import"../widgets/transfer-crypto/index.js";import{jsx as y,jsxs as b}from"react/jsx-runtime";function x({container:x,metadata:S,onError:C,presentation:w}={}){let{state:T,controller:E}=t(),D=e(),O=T.name!==`closed`;return n({state:T,settlement:D.settlement,quote:D.quote,metadata:S}),r(),y(i,{open:O,onOpenChange:e=>{e||E.close()},container:x,...w?{presentation:w}:{},children:b(a.Boundary,{...C?{onError:C}:{},children:[y(a.Guards,{children:b(a.Steps,{children:[y(a.Step,{name:`deposit`,children:y(p,{})}),y(a.Step,{name:`assetPicker`,children:y(l,{})}),y(a.Step,{name:`amountEntry`,children:y(c,{})}),y(a.Step,{name:`cashAmountEntry`,children:y(u,{})}),y(a.Step,{name:`cashConfirm`,children:y(d,{})}),y(a.Step,{name:`confirmDeposit`,children:y(f,{})}),y(a.Step,{name:`transferCrypto`,children:y(v,{})}),y(a.Step,{name:`processing`,children:y(g,{})}),y(a.Step,{name:`success`,children:y(_,{})}),y(a.Step,{name:`error`,children:y(h,{})}),y(a.Step,{name:`activityList`,children:y(s,{})}),y(a.Step,{name:`activityDetail`,children:y(o,{})})]})}),y(m,{})]})})}export{x as DepositDialog};
@@ -0,0 +1 @@
1
+ "use client";import{Trans as e}from"../../../shared/i18n/Trans.js";import"../../../i18n/index.js";import{useDepositActions as t}from"../orchestrator/controller.js";import{WalletIcon as n}from"../../../shared/icons/WalletIcon.js";import"../../../icons/index.js";import{useConnectWallet as r}from"../../../shared/wallet/ConnectWalletContext.js";import{Button as i}from"../../../shared/ui/Button/Button.js";import{Dialog as a}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Card as o}from"../../../shared/ui/Card/Card.js";import{text as s}from"../../../shared/ui/Text/Text.js";import"../../../ui/index.js";import{Frame as c}from"../../../shared/dialog/Frame.js";import{styles as l}from"./WalletRequiredState.styles.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"@stylexjs/stylex";function p(){return d(`div`,{"aria-hidden":!0,...f.props(l.heroRing),children:[d(`svg`,{viewBox:`0 0 64 64`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,...f.props(l.heroRingSvg),children:[u(`circle`,{cx:`32`,cy:`32`,r:`28`,strokeWidth:`2`,style:{stroke:`color-mix(in oklab, var(--stridge-kit-info) 55%, transparent)`}}),u(`circle`,{cx:`32`,cy:`32`,r:`20`,style:{fill:`var(--stridge-kit-info)`}})]}),u(n,{style:{color:`var(--stridge-kit-info-foreground)`},...f.props(l.heroRingGlyph)})]})}function m(){let{close:n}=t(),m=r();return d(c,{"data-stridge-slot":`deposit-wallet-required`,"data-testid":`deposit-wallet-required`,...f.props(l.root),children:[d(o.Header,{...f.props(l.header),children:[u(s.span,{size:`base`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,children:u(e,{id:`5AApJw`,message:`Connect a wallet to continue`})}),u(a.CloseButton,{})]}),u(o.Body,{children:d(`div`,{"data-stridge-slot":`deposit-wallet-required-hero`,...f.props(l.hero),children:[u(p,{}),u(s.span,{size:`lg`,fontWeight:`semibold`,leading:`tight`,tracking:`tight`,align:`center`,...f.props(l.heroHeadline),children:u(e,{id:`BoQOH3`,message:`A wallet is required to deposit`})}),u(s.span,{size:`sm`,leading:`normal`,align:`center`,color:`subdued`,...f.props(l.heroReason),children:u(e,{id:`mF_ucv`,message:`Connect a wallet so the gateway can provision a deposit address and route your transfer.`})})]})}),d(o.Footer,{...f.props(l.footer),children:[m?u(i,{variant:`default`,size:`cta`,onClick:()=>{m.onClick()},"data-stridge-slot":`deposit-wallet-required-connect`,...f.props(l.cta),children:m.label??u(e,{id:`VHOVEJ`,message:`Connect wallet`})}):null,u(i,{variant:m?`ghost`:`default`,size:`cta`,onClick:n,"data-stridge-slot":`deposit-wallet-required-close`,...f.props(l.cta),children:u(e,{id:`yz7wBu`,message:`Close`})})]})]})}export{m as WalletRequiredState};
@@ -0,0 +1 @@
1
+ const e={root:{"WalletRequiredState__styles.root":`WalletRequiredState__styles.root`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`xh8yej3`,"maxWidth-ks0D6T":`x17fpy1y`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:25`},header:{"WalletRequiredState__styles.header":`WalletRequiredState__styles.header`,"justifyContent-kjj79g":`x1qughib`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:34`},hero:{"WalletRequiredState__styles.hero":`WalletRequiredState__styles.hero`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"alignItems-kGNEyG":`x6s0dn4`,"gap-kOIVth":`x883omv`,"paddingTop-kLKAdn":`x9desvi`,"paddingInline-kg3NbH":`x65v0h`,"paddingBottom-kGO01o":`x1hhzuzn`,"animationName-kKVMdj":`xv305lp`,"animationDuration-k44tkh":`xmprevt x1s1fvk8`,"animationTimingFunction-kyAemX":`xrkt6z0`,"animationFillMode-kWV6AL":`x1u6ievf`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:42`},heroRing:{"WalletRequiredState__styles.heroRing":`WalletRequiredState__styles.heroRing`,"position-kVAEAm":`x1n2onr6`,"width-kzqmXN":`x1fu8urw`,"height-kZKoxP":`x1peatla`,"flexShrink-kmuXW":`x2lah0s`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:64`},heroRingSvg:{"WalletRequiredState__styles.heroRingSvg":`WalletRequiredState__styles.heroRingSvg`,"display-k1xSpc":`x1lliihq`,"width-kzqmXN":`xh8yej3`,"height-kZKoxP":`x5yr21d`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:73`},heroRingGlyph:{"WalletRequiredState__styles.heroRingGlyph":`WalletRequiredState__styles.heroRingGlyph`,"position-kVAEAm":`x10l6tqk`,"insetInlineStart-kLqNvP":`xbudbmw`,"top-k87sOh":`xwa60dl`,"transform-k3aq6I":`x11lhmoz`,"width-kzqmXN":`xgd8bvy`,"height-kZKoxP":`x1fgtraw`,"strokeWidth-kfJifR":`xvlca1e`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:87`},heroHeadline:{"WalletRequiredState__styles.heroHeadline":`WalletRequiredState__styles.heroHeadline`,"marginTop-keoZOQ":`x1k70j0n`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:96`},heroReason:{"WalletRequiredState__styles.heroReason":`WalletRequiredState__styles.heroReason`,"maxWidth-ks0D6T":`x1va8c73`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:99`},footer:{"WalletRequiredState__styles.footer":`WalletRequiredState__styles.footer`,"display-k1xSpc":`x78zum5`,"flexDirection-kXwgrk":`xdt5ytf`,"alignItems-kGNEyG":`x1qjc9v5`,"gap-kOIVth":`x1a6yh9e`,"paddingTop-kLKAdn":`x109j2v6`,"paddingInline-kg3NbH":`x65v0h`,"paddingBottom-kGO01o":`x1t4gjm`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:107`},cta:{"WalletRequiredState__styles.cta":`WalletRequiredState__styles.cta`,"width-kzqmXN":`xh8yej3`,"alignSelf-kSGwAc":`xkh2ocl`,$$css:`@stridge/kit:src/flows/deposit/dialog/WalletRequiredState.styles.ts:116`}};export{e as styles};
@@ -40,6 +40,40 @@ interface WalletPayload {
40
40
  */
41
41
  balanceTotalUsd?: FormattedField<number>;
42
42
  }
43
+ /**
44
+ * Capability descriptor for a single cash-rail payment method (Card / Apple Pay / Google Pay).
45
+ * Drivers populate the per-method limit + processing-time the deposit-method picker surfaces on
46
+ * the cash rows' meta line (`"$116,000.00 limit · Instant"`). Both fields are optional so the
47
+ * meta line drops segments gracefully when the driver doesn't surface them yet.
48
+ */
49
+ interface CashMethodCapability {
50
+ /**
51
+ * Per-method maximum deposit, in USD. `value` is the raw ceiling for sorting / range checks;
52
+ * `formatted` is the localized currency string (`"$116,000.00"`). The widget composes the
53
+ * meta segment from the formatted string plus a localized `" limit"` suffix.
54
+ */
55
+ limit?: FormattedField<number>;
56
+ /**
57
+ * Estimated time from confirmation to credit. `value` is seconds (`0` = instant); `formatted`
58
+ * is the localized display label the widget renders verbatim (`"Instant"`, `"5 min"`, …).
59
+ * Drivers pre-format because the kit's i18n macros do not have driver-thread access.
60
+ */
61
+ processingTime?: FormattedField<number>;
62
+ }
63
+ /**
64
+ * Per-cash-method capability bag surfaced on `DepositSnapshot.cashMethods`. Each key matches a
65
+ * method id rendered inside `Deposit.MethodSection`; the orchestrated `Deposit` widget reads each
66
+ * row's `limit` + `processingTime` and maps them into the row's meta line. Future cash methods
67
+ * (`bankTransfer`, `cashPickup`, …) extend this shape additively.
68
+ */
69
+ interface CashMethodsPayload {
70
+ /** Capabilities for the Card method (`Deposit.Method` row in the cash rail). */
71
+ card?: CashMethodCapability;
72
+ /** Capabilities for the Apple Pay method. */
73
+ applePay?: CashMethodCapability;
74
+ /** Capabilities for the Google Pay method. */
75
+ googlePay?: CashMethodCapability;
76
+ }
43
77
  /**
44
78
  * Brand context surfaced across the kit's chrome — `<DialogShell>` title, `<ConfirmDeposit>`
45
79
  * destination row, `<ProcessingState>` header pill, `<SuccessState>` "credited to" line. The host
@@ -95,7 +129,13 @@ interface AssetPayload {
95
129
  */
96
130
  interface TargetPayload extends ChainPayload, AssetPayload {
97
131
  /** Optional minimum-deposit USD floor surfaced on amount-entry / asset-picker chrome. */
98
- minDepositUsd?: FormattedField<number>;
132
+ minAmountUsd?: FormattedField<number>;
133
+ /**
134
+ * Optional upper USD bound on the deposit amount. When set, the amount-entry treats
135
+ * `min(walletBalanceUsd, maxAmountUsd.value)` as the effective ceiling. Omitted when the
136
+ * host did not configure `flows.deposit.maxAmountUsd`.
137
+ */
138
+ maxAmountUsd?: FormattedField<number>;
99
139
  }
100
140
  /**
101
141
  * Per-chain deposit address provisioned by `gateway/start`. The kit ships one envelope item per
@@ -111,9 +151,9 @@ interface AddressItemPayload extends ChainPayload {
111
151
  * Per-chain minimum-deposit USD floor surfaced next to the chain row in the transfer-crypto
112
152
  * picker (`"Min $5"`). Drivers populate this from `supportedAssets`'s per-(chain × asset)
113
153
  * floors so the user sees the right number for the chain they're funding from. Optional —
114
- * the picker falls back to {@link TargetPayload.minDepositUsd} when this isn't available.
154
+ * the picker falls back to {@link TargetPayload.minAmountUsd} when this isn't available.
115
155
  */
116
- minDepositUsd?: FormattedField<number>;
156
+ minAmountUsd?: FormattedField<number>;
117
157
  /**
118
158
  * Tokens the gateway accepts on this chain (`gateway/start.deposit_addresses[i].accepted_assets`).
119
159
  * Drives the transfer-crypto Tokens dropdown — when the user picks a chain, the dropdown
@@ -140,6 +180,13 @@ interface AcceptedAssetPayload {
140
180
  assetLogoUrl?: string;
141
181
  /** True for the chain's native gas token (synthesized from an empty `address`). */
142
182
  isNative: boolean;
183
+ /**
184
+ * Estimated price impact of depositing this asset, as a percentage decimal string
185
+ * (`"0.5"`, `"1.25"`). Joined from the `gateway/assets` catalog by (chain × contract address)
186
+ * — the wire's `accepted_assets` doesn't carry it. Drives the price-impact hint on the
187
+ * transfer-crypto disclosure row. Omitted when the catalog has no estimate for this asset.
188
+ */
189
+ priceImpact?: string;
143
190
  }
144
191
  /**
145
192
  * Source-side per-asset balance — what the connected wallet holds across supported chains. Drives
@@ -154,7 +201,7 @@ interface BalanceItemPayload extends ChainPayload, AssetPayload {
154
201
  priceUsd?: number;
155
202
  /**
156
203
  * `true` when this row's USD value is below the kit's deposit floor
157
- * ({@link TargetPayload.minDepositUsd}). Drives the muted "Low Balance" badge in the asset
204
+ * ({@link TargetPayload.minAmountUsd}). Drives the muted "Low Balance" badge in the asset
158
205
  * picker; the row remains visible so the user knows the asset exists in the wallet.
159
206
  */
160
207
  lowBalance?: boolean;
@@ -339,4 +386,4 @@ interface SettlementFailurePayload {
339
386
  */
340
387
  type SettlementPayload = SettlementPendingPayload | SettlementSuccessPayload | SettlementFailurePayload;
341
388
  //#endregion
342
- export { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload };
389
+ export { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, CashMethodCapability, CashMethodsPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload };
@@ -0,0 +1,2 @@
1
+ import { I18n } from "@lingui/core";
2
+ import { OnchainBalanceResponse, SupportedAssetsResponse } from "@stridge/sdk";
@@ -1 +1 @@
1
- import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.minDepositUsd!==void 0&&s.minDepositUsd>0&&l<s.minDepositUsd;return{networkId:a,networkName:r,eip155Id:String(i),symbol:o.symbol,decimals:o.decimals,address:o.token_address||`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,isNative:o.is_native,...d?{assetLogoUrl:d}:{},amount:{value:c,formatted:t(c,s.i18n,{compact:!0})},...l>0?{amountUsd:{value:l,formatted:n(l,s.i18n)}}:{},...u>0?{priceUsd:u}:{},...f?{lowBalance:!0,disabled:!0}:{}}}function o(e,t,n){let r=String(e);return t.is_native?n.nativeChains.has(r):t.token_address?n.tokens.has(`${r}:${t.token_address.toLowerCase()}`):!1}function s(e,t){return(t.amountUsd?.value??0)-(e.amountUsd?.value??0)}export{i as balanceToBalancesPayload,r as buildRoutableAllowlist};
1
+ import{parseDecimalSafe as e}from"../../../shared/transformers/parseSmallestUnit.js";import{formatTokenAmount as t}from"../../../../shared/format/formatTokenAmount.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";function r(e){let t=new Set,n=new Set;for(let r of e.assets){let e=String(r.eip155_id);t.add(e);for(let t of r.assets)t.address&&n.add(`${e}:${t.address.toLowerCase()}`)}return{nativeChains:t,tokens:n}}function i(e,t){let n=t.routable!==void 0&&(t.routable.nativeChains.size>0||t.routable.tokens.size>0),r=[];for(let i of e.chains)for(let e of i.tokens)e.is_spam||n&&t.routable&&!o(i.eip155_id,e,t.routable)||r.push(a(i.label,i.eip155_id,i.stridge_network_id,e,t));return r.sort(s),r}function a(r,i,a,o,s){let c=e(o.amount),l=e(o.amount_usd),u=e(o.usd_price),d=s.resolveTokenIcon?.({chainId:i,tokenAddress:o.token_address,symbol:o.symbol,isNative:o.is_native})??s.logos?.(i,o.token_address,o.is_native)??o.logo??void 0,f=s.minAmountUsd!==void 0&&s.minAmountUsd>0&&l<s.minAmountUsd;return{networkId:a,networkName:r,eip155Id:String(i),symbol:o.symbol,decimals:o.decimals,address:o.token_address||`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,isNative:o.is_native,...d?{assetLogoUrl:d}:{},amount:{value:c,formatted:t(c,s.i18n,{compact:!0})},...l>0?{amountUsd:{value:l,formatted:n(l,s.i18n)}}:{},...u>0?{priceUsd:u}:{},...f?{lowBalance:!0,disabled:!0}:{}}}function o(e,t,n){let r=String(e);return t.is_native?n.nativeChains.has(r):t.token_address?n.tokens.has(`${r}:${t.token_address.toLowerCase()}`):!1}function s(e,t){return(t.amountUsd?.value??0)-(e.amountUsd?.value??0)}export{i as balanceToBalancesPayload,r as buildRoutableAllowlist};
@@ -0,0 +1 @@
1
+ import { SettlementPayloadContext } from "./settlementToPayload.js";
@@ -0,0 +1,2 @@
1
+ import { I18n } from "@lingui/core";
2
+ import { QuoteResponse } from "@stridge/sdk";
@@ -0,0 +1,25 @@
1
+ import { I18n } from "@lingui/core";
2
+ import { GatewaySettlementDto, GatewayUdaDto } from "@stridge/sdk";
3
+
4
+ //#region src/flows/deposit/driver/transformers/settlementToPayload.d.ts
5
+ /**
6
+ * Inputs the {@link settlementToPayload} transformer needs from the driver. The driver carries
7
+ * connected-wallet metadata and explorer info; the transformer composes the per-leg URLs and
8
+ * shortened address forms that the widget renders.
9
+ */
10
+ interface SettlementPayloadContext {
11
+ /** Lingui i18n instance — drives every formatter call. */
12
+ i18n: I18n;
13
+ /** Connected wallet's source-side metadata — name + address (full hex). */
14
+ sourceWallet: {
15
+ name?: string;
16
+ address: string;
17
+ explorerUrl?: string;
18
+ };
19
+ /** Per-EIP-155 block-explorer base URLs (e.g. `{ 1: "https://etherscan.io" }`). */
20
+ explorers?: Record<number, string>;
21
+ /** Optional brand label rendered in place of the destination address (`gateway/start.metadata.brand_name`). */
22
+ brandName?: string;
23
+ }
24
+ //#endregion
25
+ export { SettlementPayloadContext };
@@ -1 +1 @@
1
- import{classifyFailureKind as e,classifySettlementStatus as t}from"../../../shared/transformers/classifySettlementStatus.js";import{parseDecimalSafe as n,parseSmallestUnit as r}from"../../../shared/transformers/parseSmallestUnit.js";import{parseIsoMs as i}from"../../../shared/transformers/parseIsoMs.js";import"../../../shared/transformers/pickRelevantSettlement.js";import{formatDurationCompact as a}from"../../../../shared/format/formatDurationCompact.js";import{formatTimestamp as o}from"../../../../shared/format/formatTimestamp.js";import{formatTokenAmount as s}from"../../../../shared/format/formatTokenAmount.js";import{shortenAddress as c}from"../../../../shared/format/shortenAddress.js";function l(e,n,r){let i=t(e.status);return i===`completed`?d(e,n,r):i===`failed`?f(e,n,r):u(e,n,r)}function u(e,t,n){let r=e.from,a=i(r?.confirmed_at)??i(e.created_at),l=i(r?.confirmed_at)??i(e.created_at)??Date.now(),u=m(e.to,t.destination.asset_decimals);return{kind:`pending`,sourceWallet:p(n),creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},creditedTo:n.brandName??t.destination.address,...r?.tx_id?{txHash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{txExplorerUrl:h(r,n,r.tx_id)}:{}}:{},...a===void 0?{}:{detectedAt:{value:a,formatted:o(a,n.i18n)}},submittedAt:{value:l,formatted:o(l,n.i18n)},receiveAmount:{value:u,formatted:s(u,n.i18n,{maxDecimals:t.destination.asset_decimals})}}}function d(e,t,n){let r=e.from,l=e.to,u=i(r?.confirmed_at)??i(e.created_at)??Date.now(),d=i(l?.settled_at)??i(e.updated_at)??Date.now(),f=Math.max(0,d-u),_=m(l,t.destination.asset_decimals),v=t.destination.address;return{kind:`succeeded`,sourceWallet:p(n),destination:{...n.brandName?{name:n.brandName}:{},address:{value:v,formatted:c(v)}},creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},receiveAmount:{value:_,formatted:s(_,n.i18n,{maxDecimals:t.destination.asset_decimals})},routeHops:g(e),totalTime:{value:f,formatted:a(f,n.i18n)},...r?.tx_id?{depositTx:{hash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{explorerUrl:h(r,n,r.tx_id)}:{}}}:{depositTx:{hash:{value:``,formatted:``}}},...l?.tx_id?{completionTx:{hash:{value:l.tx_id,formatted:c(l.tx_id)},...h(l,n,l.tx_id)?{explorerUrl:h(l,n,l.tx_id)}:{}}}:{},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)}}}function f(t,n,r){let a=t.from,l=i(a?.confirmed_at)??i(t.created_at)??Date.now(),u=i(t.updated_at)??Date.now(),d=a?.tx_id??``,f=n.destination.address;return{kind:`failed`,failureKind:e(t.error),sourceWallet:p(r),destination:{...r.brandName?{name:r.brandName}:{},address:{value:f,formatted:c(f)}},creditedAsset:{symbol:n.destination.asset_symbol,decimals:n.destination.asset_decimals,address:n.destination.asset_address??``,isNative:!n.destination.asset_address},receiveAmount:{value:0,formatted:s(0,r.i18n)},txHash:{value:d,formatted:d?c(d):``},...h(a,r,d)?{txExplorerUrl:h(a,r,d)}:{},submittedAt:{value:l,formatted:o(l,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)}}}function p(e){return{...e.sourceWallet.name?{name:e.sourceWallet.name}:{},address:{value:e.sourceWallet.address,formatted:c(e.sourceWallet.address)},...e.sourceWallet.explorerUrl?{explorerUrl:e.sourceWallet.explorerUrl}:{}}}function m(e,t){if(!e)return 0;if(e.amount){let t=n(e.amount);if(t>0)return t}return e.raw_amount?r(e.raw_amount,t):0}function h(e,t,n){if(!e||!n)return;let r=e.eip155_id===void 0?void 0:Number(e.eip155_id);if(r===void 0||!t.explorers)return;let i=t.explorers[r];if(i)return`${i.replace(/\/+$/,``)}/tx/${n}`}function g(e){let t=e.from,n=e.to,r=e.route?.provider??``,i=[];return t?.eip155_id!==void 0&&i.push({provider:r,chainId:Number(t.eip155_id)}),n?.eip155_id!==void 0&&n.eip155_id!==t?.eip155_id&&i.push({provider:r,chainId:Number(n.eip155_id)}),i}export{l as settlementToPayload};
1
+ import{classifyFailureKind as e,classifySettlementStatus as t}from"../../../shared/transformers/classifySettlementStatus.js";import{parseDecimalSafe as n,parseSmallestUnit as r}from"../../../shared/transformers/parseSmallestUnit.js";import{parseIsoMs as i}from"../../../shared/transformers/parseIsoMs.js";import"../../../shared/transformers/pickRelevantSettlement.js";import{formatDurationCompact as a}from"../../../../shared/format/formatDurationCompact.js";import{formatTimestamp as o}from"../../../../shared/format/formatTimestamp.js";import{formatTokenAmount as s}from"../../../../shared/format/formatTokenAmount.js";import{shortenAddress as c}from"../../../../shared/format/shortenAddress.js";function l(e,n,r){let i=t(e.status);return i===`completed`?d(e,n,r):i===`failed`?f(e,n,r):u(e,n,r)}function u(e,t,n){let r=e.from,a=i(r?.confirmed_at)??i(e.created_at),l=i(r?.confirmed_at)??i(e.created_at)??Date.now(),u=m(e.to,t.destination.asset_decimals);return{kind:`pending`,sourceWallet:p(n),creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},creditedTo:n.brandName??c(t.destination.address),...r?.tx_id?{txHash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{txExplorerUrl:h(r,n,r.tx_id)}:{}}:{},...a===void 0?{}:{detectedAt:{value:a,formatted:o(a,n.i18n)}},submittedAt:{value:l,formatted:o(l,n.i18n)},receiveAmount:{value:u,formatted:s(u,n.i18n,{maxDecimals:t.destination.asset_decimals})}}}function d(e,t,n){let r=e.from,l=e.to,u=i(r?.confirmed_at)??i(e.created_at)??Date.now(),d=i(l?.settled_at)??i(e.updated_at)??Date.now(),f=Math.max(0,d-u),_=m(l,t.destination.asset_decimals),v=t.destination.address;return{kind:`succeeded`,sourceWallet:p(n),destination:{...n.brandName?{name:n.brandName}:{},address:{value:v,formatted:c(v)}},creditedAsset:{symbol:t.destination.asset_symbol,decimals:t.destination.asset_decimals,address:t.destination.asset_address??``,isNative:!t.destination.asset_address},receiveAmount:{value:_,formatted:s(_,n.i18n,{maxDecimals:t.destination.asset_decimals})},routeHops:g(e),totalTime:{value:f,formatted:a(f,n.i18n)},...r?.tx_id?{depositTx:{hash:{value:r.tx_id,formatted:c(r.tx_id)},...h(r,n,r.tx_id)?{explorerUrl:h(r,n,r.tx_id)}:{}}}:{depositTx:{hash:{value:``,formatted:``}}},...l?.tx_id?{completionTx:{hash:{value:l.tx_id,formatted:c(l.tx_id)},...h(l,n,l.tx_id)?{explorerUrl:h(l,n,l.tx_id)}:{}}}:{},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)}}}function f(t,n,r){let a=t.from,l=i(a?.confirmed_at)??i(t.created_at)??Date.now(),u=i(t.updated_at)??Date.now(),d=a?.tx_id??``,f=n.destination.address;return{kind:`failed`,failureKind:e(t.error),sourceWallet:p(r),destination:{...r.brandName?{name:r.brandName}:{},address:{value:f,formatted:c(f)}},creditedAsset:{symbol:n.destination.asset_symbol,decimals:n.destination.asset_decimals,address:n.destination.asset_address??``,isNative:!n.destination.asset_address},receiveAmount:{value:0,formatted:s(0,r.i18n)},txHash:{value:d,formatted:d?c(d):``},...h(a,r,d)?{txExplorerUrl:h(a,r,d)}:{},submittedAt:{value:l,formatted:o(l,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)}}}function p(e){return{...e.sourceWallet.name?{name:e.sourceWallet.name}:{},address:{value:e.sourceWallet.address,formatted:c(e.sourceWallet.address)},...e.sourceWallet.explorerUrl?{explorerUrl:e.sourceWallet.explorerUrl}:{}}}function m(e,t){if(!e)return 0;if(e.amount){let t=n(e.amount);if(t>0)return t}return e.raw_amount?r(e.raw_amount,t):0}function h(e,t,n){if(!e||!n)return;let r=e.eip155_id===void 0?void 0:Number(e.eip155_id);if(r===void 0||!t.explorers)return;let i=t.explorers[r];if(i)return`${i.replace(/\/+$/,``)}/tx/${n}`}function g(e){let t=e.from,n=e.to,r=e.route?.provider??``,i=[];return t?.eip155_id!==void 0&&i.push({provider:r,chainId:Number(t.eip155_id)}),n?.eip155_id!==void 0&&n.eip155_id!==t?.eip155_id&&i.push({provider:r,chainId:Number(n.eip155_id)}),i}export{l as settlementToPayload};
@@ -0,0 +1,2 @@
1
+ import { I18n } from "@lingui/core";
2
+ import { DepositAddressDto } from "@stridge/sdk";
@@ -1 +1 @@
1
- import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";import{shortenAddress as n}from"../../../../shared/format/shortenAddress.js";const r=new Set([11155111,5,80001,80002,84532,421614,11155420,97]);function i(i,o={}){let s=o.includeTestnets??!1;return i.flatMap(i=>{let c=String(i.eip155_id??``),l=Number(c);if(!s&&Number.isFinite(l)&&r.has(l))return[];let u=o.explorers?.[l],d=o.i18n&&c?o.minDepositUsdByEip155Id?.[c]:void 0,f=a(i.accepted_assets,c?o.nativeAssetByEip155Id?.[c]:void 0);return[{networkName:e(i.network_name??``),...c?{eip155Id:c}:{},...o.chainLogos?.[c]?{chainLogoUrl:o.chainLogos[c]}:{},address:{value:i.address,formatted:n(i.address)},...u?{explorerUrl:`${u.replace(/\/+$/,``)}/address/${i.address}`}:{},...d!==void 0&&o.i18n?{minDepositUsd:{value:d,formatted:t(d,o.i18n)}}:{},...f.length>0?{acceptedAssets:f}:{}}]})}function a(e,t){let n=Array.isArray(e)?e.map(o):[];return!t||new Set(n.map(e=>e.symbol.toUpperCase())).has(t.symbol.toUpperCase())?n:[t,...n]}function o(e){let t=e.logo,n=!e.address;return{symbol:e.symbol,address:e.address,decimals:e.decimals,...typeof t==`string`&&t.length>0?{assetLogoUrl:t}:{},isNative:n}}export{i as startToAddressesPayload};
1
+ import{KNOWN_TESTNET_EIP155_IDS as e}from"../../../shared/transformers/testnets.js";import{formatNetworkName as t}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as n}from"../../../../shared/format/formatUsd.js";import{shortenAddress as r}from"../../../../shared/format/shortenAddress.js";function i(i,o={}){let s=o.includeTestnets??!1;return i.flatMap(i=>{let c=String(i.eip155_id??``),l=Number(c);if(!s&&Number.isFinite(l)&&e.has(l))return[];let u=o.explorers?.[l],d=o.i18n&&c?o.minAmountUsdByEip155Id?.[c]:void 0,f=a(i.accepted_assets,c?o.nativeAssetByEip155Id?.[c]:void 0,c?o.priceImpactByEip155Id?.[c]:void 0);return[{networkName:t(i.network_name??``),...c?{eip155Id:c}:{},...o.chainLogos?.[c]?{chainLogoUrl:o.chainLogos[c]}:{},address:{value:i.address,formatted:r(i.address)},...u?{explorerUrl:`${u.replace(/\/+$/,``)}/address/${i.address}`}:{},...d!==void 0&&o.i18n?{minAmountUsd:{value:d,formatted:n(d,o.i18n)}}:{},...f.length>0?{acceptedAssets:f}:{}}]})}function a(e,t,n){let r=Array.isArray(e)?e.map(e=>o(e,n)):[];if(!t)return r;let i=r.findIndex(e=>e.symbol.toUpperCase()===t.symbol.toUpperCase());if(i>=0){let e=r[i];return e&&!e.priceImpact&&t.priceImpact&&(r[i]={...e,priceImpact:t.priceImpact}),r}return[t,...r]}function o(e,t){let n=e.logo,r=!e.address,i=e.address?t?.[e.address.toLowerCase()]:void 0;return{symbol:e.symbol,address:e.address,decimals:e.decimals,...typeof n==`string`&&n.length>0?{assetLogoUrl:n}:{},isNative:r,...i?{priceImpact:i}:{}}}export{i as startToAddressesPayload};
@@ -0,0 +1 @@
1
+ import { GatewayStartResponse } from "@stridge/sdk";
@@ -0,0 +1,2 @@
1
+ import { I18n } from "@lingui/core";
2
+ import { SupportedAssetsResponse } from "@stridge/sdk";
@@ -1 +1 @@
1
- import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.minDepositUsd===void 0?{}:{minDepositUsd:{value:r.minDepositUsd,formatted:t(r.minDepositUsd,r.i18n)}}}}export{n as startToTargetPayload};
1
+ import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";import{formatUsd as t}from"../../../../shared/format/formatUsd.js";function n(n,r){let i=n.assets.find(e=>String(e.network_id)===r.networkId);if(!i)return;let a=i.assets.find(e=>e.symbol.toUpperCase()===r.assetSymbol.toUpperCase());if(!a)return;let o=i.native_currency?.logo;return{networkId:r.networkId,networkName:e(i.network_name),eip155Id:String(i.eip155_id),...o?{chainLogoUrl:o}:{},symbol:a.symbol,decimals:a.decimals,address:a.address??``,isNative:!a.address,...a.logo?{assetLogoUrl:a.logo}:{},...r.minAmountUsd===void 0?{}:{minAmountUsd:{value:r.minAmountUsd,formatted:t(r.minAmountUsd,r.i18n)}},...r.maxAmountUsd===void 0?{}:{maxAmountUsd:{value:r.maxAmountUsd,formatted:t(r.maxAmountUsd,r.i18n)}}}}export{n as startToTargetPayload};
@@ -1,6 +1,6 @@
1
1
  import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
2
- import { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload } from "./payloads.js";
3
- import { DepositAddressDto, GatewayPollResponse, GatewaySettlementDto, GatewayStartResponse, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
2
+ import { AcceptedAssetPayload, AddressItemPayload, AssetPayload, BalanceItemPayload, BrandPayload, CashMethodCapability, CashMethodsPayload, ChainPayload, QuoteBreakdownPayload, QuotePayload, QuoteRoutePayload, SettlementFailurePayload, SettlementPayload, SettlementPendingPayload, SettlementSuccessPayload, SourceWalletPayload, TargetPayload, WalletInfo, WalletPayload } from "./payloads.js";
3
+ import { DepositAddressDto, GatewaySettlementDto, GatewayStartResponse, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
4
4
 
5
5
  //#region src/flows/deposit/driver/types.d.ts
6
6
  /**
@@ -39,7 +39,7 @@ interface DepositSnapshot {
39
39
  * the payload (`pending` / `succeeded` / `failed`) drives whether `<ProcessingState>`,
40
40
  * `<SuccessState>`, or `<ErrorState>` is shown.
41
41
  */
42
- settlement: Entity<SettlementPayload, GatewaySettlementDto, GatewayPollResponse>;
42
+ settlement: Entity<SettlementPayload, GatewaySettlementDto, GatewayUdaDto>;
43
43
  /**
44
44
  * Connected-wallet identity. `idle` when no wallet is connected; `ready` once the host has
45
45
  * supplied an address. The `payload.address.formatted` field is the canonical
@@ -47,6 +47,15 @@ interface DepositSnapshot {
47
47
  * settlement (deposit-method tile, amount-entry source pill, banner disconnected-state copy).
48
48
  */
49
49
  wallet: Entity<WalletPayload, WalletInfo, WalletInfo>;
50
+ /**
51
+ * Per-cash-method capability bag — limits + processing times surfaced on the cash-rail
52
+ * method rows' meta line. Optional so BYO drivers shipped before the cash rail existed
53
+ * keep type-checking against the contract; readers null-coalesce a missing entity to
54
+ * `idle`, which already means "no cash backend wired up yet" in the kit's reducer. The
55
+ * live stridge driver wires this through `getCashMethods()` once the cash API ships; the
56
+ * mock driver seeds fixtures today.
57
+ */
58
+ cashMethods?: Entity<CashMethodsPayload, CashMethodsPayload, CashMethodsPayload>;
50
59
  }
51
60
  /**
52
61
  * Input to {@link DepositDriver.requestQuote}.
@@ -107,7 +116,7 @@ type FetchActiveSettlementInput = Record<string, never>;
107
116
  interface SettlementSnapshot {
108
117
  payload: SettlementPayload;
109
118
  raw: GatewaySettlementDto;
110
- response: GatewayPollResponse;
119
+ response: GatewayUdaDto;
111
120
  }
112
121
  /**
113
122
  * Unified driver contract. A `DepositDriver` is the single host-supplied source of both reactive
@@ -139,6 +148,17 @@ interface DepositDriver {
139
148
  getSnapshot(): DepositSnapshot;
140
149
  /** Lets you subscribe to entity transitions outside React (analytics, headless integrations). */
141
150
  subscribe(listener: () => void): () => void;
151
+ /**
152
+ * Idempotent bootstrap trigger. The kit calls this from `useDeposit().open()` and the
153
+ * headless `usePrefetchDeposit()` hook. First call kicks off any deferred network work
154
+ * (`gateway/start`, `supportedAssets`, the initial `balance/onchain` fetch); subsequent
155
+ * calls are no-ops while bootstrap is in flight or completed.
156
+ *
157
+ * BYO drivers that bootstrap eagerly can implement this as a no-op — the contract is "after
158
+ * `arm()` returns, the driver's entities are either already populated or will populate as
159
+ * soon as the first network round-trips land".
160
+ */
161
+ arm(): void;
142
162
  /**
143
163
  * Fetches a fresh quote for `input` and updates the `quote` entity through its lifecycle
144
164
  * (`idle | loading → ready | error`). The optional `signal` cancels in-flight work.
@@ -154,6 +174,19 @@ interface DepositDriver {
154
174
  * — when omitted, the asset-picker hides its USD-balance overlay.
155
175
  */
156
176
  watchBalances?(input: Record<string, never>, listener: (entity: DepositSnapshot["balances"]) => void, signal: AbortSignal): void;
177
+ /**
178
+ * Invalidate any cached `balances` and force the driver to fetch fresh on its next tick. The
179
+ * orchestrator calls this after `submitDeposit` resolves and on every `settlement` kind
180
+ * transition (`pending` / `succeeded` / `failed`) so the user never advances on stale
181
+ * source-chain balance numbers — the `balance/onchain` SWR window otherwise hides the
182
+ * just-sent funds until it elapses.
183
+ *
184
+ * Drivers that do not cache balances (no SWR layer, no in-memory snapshot) can omit this; the
185
+ * kit calls it via optional chaining. When implemented, drivers should both invalidate the
186
+ * cache stamp and kick off an immediate refetch so `useDepositSnapshot().balances` reflects
187
+ * post-deposit reality without waiting for the next scheduled watcher tick.
188
+ */
189
+ invalidateBalances?(): void;
157
190
  /**
158
191
  * Path B watcher — observes the deposit address until an inbound source-chain tx is detected,
159
192
  * then fires the listener with the {@link TxRef}. Optional — when omitted, the orchestrator
@@ -1 +1 @@
1
- "use client";import{useDepositDriverInstance as e}from"../driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{initialState as s,reducer as c}from"./reducer.js";import{resolveAssetById as l}from"./resolveAssetById.js";import{createContext as u,use as d,useCallback as f,useEffect as p,useMemo as m,useReducer as h,useRef as g}from"react";import{jsx as _}from"react/jsx-runtime";const v={id:`ELhVSL`,message:`Failed to submit deposit.`},y={id:`Ej5HL9`,message:`Signature declined. Please try again.`},b=u(null);b.displayName=`GatewayControllerContext`;function x(){let e=d(b);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function S(){return x().state}function C(){return x().effectiveState}function w(){return x().actions}function T({children:t}){let n=e(),[r,a]=h(c,s),o=D(r,a,n);O(r,a,n),k(r,a,n);let l=i(r),u=E(r,a,n,o);return _(b,{value:m(()=>({state:r,effectiveState:l,dispatch:a,controller:u,actions:o}),[r,l,u,o]),children:t})}function E(e,t,n,r){let i=g(n);i.current=n;let a=f(e=>{if(!e)return t({type:`OPEN`,input:void 0}),!0;if(e.method===`transfer`)return t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=l(i.current.getSnapshot(),e.assetId);return n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):!1}return t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),o=f(()=>{t({type:`CLOSE`})},[t]);return m(()=>({open:a,close:o,actions:r}),[a,o,r])}function D(e,r,i){let o=g(e);o.current=e;let s=g(i);s.current=i;let c=g(r);c.current=r;let{i18n:l}=t(),u=g(l);u.current=l;let d=f((e,t)=>{let r=s.current,i=new AbortController,o=j(e,t);r.submitDeposit(o,i.signal).then(e=>{i.signal.aborted||c.current({type:`DEPOSIT_SUBMITTED`,tx:e})}).catch(e=>{if(i.signal.aborted)return;let t=n(e,u.current._(v));if(a(t)){c.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:u.current._(y)});return}c.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),p=f(e=>{c.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),h=f(e=>{c.current({type:`ASSET_CONFIRMED`,asset:e})},[]),_=f(e=>{o.current.name===`amountEntry`&&c.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),b=f(()=>{let e=o.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){c.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;c.current({type:`DEPOSIT_CONFIRMED`}),d(n,r)},[d]),x=f(()=>{c.current({type:`BACK`})},[]),S=f(()=>{c.current({type:`CLOSE`})},[]),C=f(()=>{c.current({type:`SUCCESS_DONE`})},[]),w=f(()=>{c.current({type:`ERROR_TRY_AGAIN`})},[]),T=f((e,t)=>{c.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),E=f((e,t)=>{c.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),D=f(e=>{c.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]);return m(()=>({selectMethod:p,confirmAsset:h,confirmAmount:_,confirmDeposit:b,back:x,close:S,successDone:C,tryAgain:w,resumeToProcessing:T,resumeToSuccess:E,resumeToError:D}),[p,h,_,b,x,S,C,w,T,E,D])}function O(e,t,r){p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=A(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),p(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function k(e,t,n){o(n,e.name===`processing`?e.ctx.tx:void 0),p(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{t.signal.aborted||r||(r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal))},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]),p(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,n]);let i=g(e);i.current=e,r(n,e=>{i.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let a=g(null);p(()=>{let e=()=>{let e=n.getSnapshot(),r=i.current,o=e.quote;o.status!==a.current&&(a.current=o.status,o.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:o.payload.expiresAt}):o.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:o.error.message,code:o.error.name}}))},r=n.subscribe(e);return e(),r},[n,t])}function A(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function j(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{T as GatewayController,x as useControllerContext,w as useDepositActions,C as useDepositEffectiveState,S as useDepositState};
1
+ "use client";import{useOptionalActivityDriverInstance as e}from"../../activity/driver/context.js";import{useLingui as t}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as n}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as r}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as i}from"../../../shared/orchestrator/useEffectiveState.js";import{isUserRejectionFailure as a}from"../../../shared/orchestrator/userRejection.js";import{useSettlementWatcher as o}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useDepositDriverInstance as s}from"../driver/context.js";import{initialState as c,reducer as l}from"./reducer.js";import{resolveAssetById as u}from"./resolveAssetById.js";import{createContext as d,use as f,useCallback as p,useEffect as m,useMemo as h,useReducer as g,useRef as _}from"react";import{jsx as v}from"react/jsx-runtime";const y={id:`ELhVSL`,message:`Failed to submit deposit.`},b={id:`Ej5HL9`,message:`Signature declined. Please try again.`},x=d(null);x.displayName=`GatewayControllerStateContext`;const S=d(null);S.displayName=`GatewayControllerStableContext`;function C(){let e=f(x),t=f(S);if(!e||!t)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return{...e,...t}}function w(){let e=f(S);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e}function T(){return f(S)}const E=d(void 0);E.displayName=`DepositMethodsConfigContext`;function D(){return f(E)}const O=d(!1);O.displayName=`CashRailUnlockedContext`;function k(){return f(O)}function A(e){let t=D();return h(()=>t?e.filter(e=>e.value===`cash`?t.cashRail?.disabled!==!0:!0):e,[e,t])}function j(){let e=f(x);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.state}function M(){let e=f(x);if(!e)throw Error(`useDeposit / GatewayController must be used inside <KitProvider deposit={…} />. Mount KitProvider once at the host's app root.`);return e.effectiveState}function N(){return w().actions}function P({methodsConfig:t,cashRailUnlocked:n=!1,children:r}){let a=s(),o=e(),[u,d]=g(l,c),f=I(u,d,a,o);L(u,d,a),R(u,d,a,o);let p=i(u),m=F(u,d,a,f,t);return v(E,{value:t,children:v(O,{value:n,children:v(S,{value:h(()=>({dispatch:d,controller:m,actions:f}),[d,m,f]),children:v(x,{value:h(()=>({state:u,effectiveState:p}),[u,p]),children:r})})})})}function F(e,t,n,r,i){let a=_(n);a.current=n;let o=_(i);o.current=i;let s=p(e=>{if(!e)return a.current.arm(),t({type:`OPEN`,input:void 0}),!0;if(o.current?.[e.method]?.disabled)return!1;if(e.method===`transfer`)return a.current.arm(),t({type:`OPEN`,input:{method:`transfer`}}),!0;if(e.method===`wallet`&&e.assetId!==void 0){let n=u(a.current.getSnapshot(),e.assetId);return a.current.arm(),n?(t({type:`OPEN`,input:{method:`wallet`,asset:n}}),!0):(t({type:`OPEN`,input:{method:`wallet`}}),!0)}return a.current.arm(),t({type:`OPEN`,input:{method:`wallet`}}),!0},[t]),c=p(()=>{t({type:`CLOSE`})},[t]);return h(()=>({open:s,close:c,actions:r}),[s,c,r])}function I(e,r,i,o){let s=_(e);s.current=e;let c=_(i);c.current=i;let l=_(o);l.current=o;let u=_(r);u.current=r;let{i18n:d}=t(),f=_(d);f.current=d;let m=p((e,t)=>{let r=c.current,i=new AbortController,o=B(e,t);r.submitDeposit(o,i.signal).then(e=>{if(!i.signal.aborted){try{r.invalidateBalances?.()}catch{}try{l.current?.invalidateActivity?.()}catch{}u.current({type:`DEPOSIT_SUBMITTED`,tx:e})}}).catch(e=>{if(i.signal.aborted)return;let t=n(e,f.current._(y));if(a(t)){u.current({type:`DEPOSIT_SIGNATURE_DECLINED`,notice:f.current._(b)});return}u.current({type:`DEPOSIT_SUBMISSION_FAILED`,failure:t})})},[]),g=p(e=>{u.current({type:`DEPOSIT_METHOD_SELECTED`,method:e})},[]),v=p(e=>{u.current({type:`CASH_METHOD_SELECTED`,cashMethod:e})},[]),x=p(e=>{u.current({type:`CASH_AMOUNT_CONFIRMED`,amount:e})},[]),S=p(()=>{u.current({type:`CASH_METHOD_READY`})},[]),C=p(e=>{u.current({type:`ASSET_CONFIRMED`,asset:e})},[]),w=p(e=>{s.current.name===`amountEntry`&&u.current({type:`AMOUNT_CONFIRMED`,amount:e})},[]),T=p(()=>{let e=s.current;if(e.name!==`confirmDeposit`)return;let t=e.ctx.phase;if(t.kind===`failed`){u.current({type:`QUOTE_RETRY`});return}if(t.kind!==`ready`)return;let{asset:n,amount:r}=e.ctx;u.current({type:`DEPOSIT_CONFIRMED`}),m(n,r)},[m]),E=p(()=>{u.current({type:`BACK`})},[]),D=p(()=>{u.current({type:`CLOSE`})},[]),O=p(()=>{u.current({type:`SUCCESS_DONE`})},[]),k=p(()=>{u.current({type:`ERROR_TRY_AGAIN`})},[]),A=p((e,t)=>{u.current({type:`RESUME_TO_PROCESSING`,method:e,tx:t})},[]),j=p((e,t)=>{u.current({type:`RESUME_TO_SUCCESS`,method:e,tx:t})},[]),M=p(e=>{u.current({type:`RESUME_TO_ERROR`,...e?{tx:e}:{}})},[]),N=p(()=>{if(l.current==null){process.env.NODE_ENV!==`production`&&console.warn("[@stridge/kit] useDepositActions().openActivity() was called but no activity driver is mounted. Wrap the host with `<KitProvider activity={…}>` (or `<StridgeProvider>` with any flow enabled) to enable the activity surface.");return}let e=s.current;e.name!==`deposit`&&e.name!==`assetPicker`&&e.name!==`amountEntry`&&e.name!==`transferCrypto`||u.current({type:`OPEN_ACTIVITY`})},[]),P=p(e=>{u.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return h(()=>({selectMethod:g,selectCashMethod:v,confirmCashAmount:x,cashMethodReady:S,confirmAsset:C,confirmAmount:w,confirmDeposit:T,back:E,close:D,successDone:O,tryAgain:k,resumeToProcessing:A,resumeToSuccess:j,resumeToError:M,openActivity:N,selectSettlement:P}),[g,v,x,S,C,w,T,E,D,O,k,A,j,M,N,P])}function L(e,t,r){m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`loading`&&e.ctx.phase.kind!==`regenerating`)return;let i=new AbortController,a=z(e.ctx.asset,e.ctx.amount);return r.requestQuote(a,i.signal).catch(e=>{i.signal.aborted||t({type:`QUOTE_FAILED`,failure:n(e,`Failed to fetch quote.`)})}),()=>i.abort()},[e.name,e.name===`confirmDeposit`?e.ctx.phase.kind:void 0,e.name===`confirmDeposit`?e.ctx.asset:void 0,e.name===`confirmDeposit`?e.ctx.amount:void 0,r,t]),m(()=>{if(e.name!==`confirmDeposit`||e.ctx.phase.kind!==`ready`)return;let n=e.ctx.phase.quoteExpiresAt,r=Math.max(0,n-Date.now()),i=setTimeout(()=>{t({type:`QUOTE_EXPIRED`})},r);return()=>clearTimeout(i)},[e.name,e.name===`confirmDeposit`&&e.ctx.phase.kind===`ready`?e.ctx.phase.quoteExpiresAt:void 0,t])}function R(e,t,n,i){let a=_(i);a.current=i;let s=e.name===`processing`?e.ctx.tx:void 0;o(n,s?{tx:s}:void 0,s?.hash),m(()=>{if(e.name!==`transferCrypto`||!n.watchSourceTx)return;let t=new AbortController,r;return n.watchSourceTx({},e=>{if(!t.signal.aborted&&!r){r=new AbortController,n.watchSettlement({tx:e},()=>{},r.signal);try{a.current?.invalidateActivity?.()}catch{}}},t.signal),()=>{t.abort(),r?.abort()}},[e.name,n]);let c=e.name===`activityList`||e.name===`activityDetail`;m(()=>{if(!c||!i)return;let e=new AbortController;return i.watchActivity(e.signal),()=>e.abort()},[c,i]),m(()=>{if(e.name===`closed`||e.name===`transferCrypto`||e.name===`processing`||c||!n.fetchActiveSettlement)return;let t=new AbortController,r,i,a=!1,o=async()=>{try{let e=await n.fetchActiveSettlement({},t.signal);if(a)return;if(e&&!r&&e.payload.kind===`pending`){let t=e.payload.txHash?.value;t&&(r=new AbortController,n.watchSettlement({tx:{hash:t}},()=>{},r.signal))}}catch{}a||(i=setTimeout(o,5e3))};return o(),()=>{a=!0,t.abort(),r?.abort(),i&&clearTimeout(i)}},[e.name,c,n]);let l=_(e);l.current=e,r(n,e=>{if(e===`pending`||e===`succeeded`||e===`failed`)try{n.invalidateBalances?.()}catch{}l.current.name===`processing`&&(e===`succeeded`?t({type:`PROCESSING_SUCCEEDED`}):e===`failed`&&t({type:`PROCESSING_FAILED`}))});let u=_(null);m(()=>{let e=()=>{let e=n.getSnapshot(),r=l.current,i=e.quote;i.status!==u.current&&(u.current=i.status,i.status===`ready`&&r.name===`confirmDeposit`?(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_RESOLVED`,expiresAt:i.payload.expiresAt}):i.status===`error`&&r.name===`confirmDeposit`&&(r.ctx.phase.kind===`loading`||r.ctx.phase.kind===`regenerating`)&&t({type:`QUOTE_FAILED`,failure:{reason:i.error.message,code:i.error.name,cause:i.error}}))},r=n.subscribe(e);return e(),r},[n,t])}function z(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build quote input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceTokenSymbol:e.symbol,sourceIsNative:e.isNative,amount:t,...e.priceUsd===void 0?{}:{sourcePriceUsd:e.priceUsd}}}function B(e,t){let n=e.eip155Id;if(!n)throw Error(`Asset ${e.symbol} is missing eip155Id; cannot build submit input.`);return{sourceChainId:Number(n),sourceTokenAddress:e.address,sourceTokenDecimals:e.decimals,sourceIsNative:e.isNative,amount:t}}export{P as GatewayController,k as useCashRailUnlocked,C as useControllerContext,N as useDepositActions,M as useDepositEffectiveState,D as useDepositMethodsConfig,j as useDepositState,A as useEnabledRails,T as useOptionalStableControllerContext,w as useStableControllerContext};
@@ -0,0 +1,5 @@
1
+ import { FailureInfo } from "../../../shared/orchestrator/types.js";
2
+ import { CashConfirmPhase, CashMethodId, ConfirmDepositPhase, DepositActions, DepositController, DepositMethod, DepositMethodConfig, DepositMethodsConfig, DepositRailConfig, DepositState, DepositStateName, GatewayEvent, OpenInput, ResolvedOpenInput, RetryTargetSpec } from "./types.js";
3
+ import { useDepositState } from "./controller.js";
4
+ import { STEPS_WITH_OWN_SETTLEMENT_VIEW, stepRendersSettlement } from "./steps.js";
5
+ import { useDeposit } from "./useDeposit.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -1 +1 @@
1
- const e={name:`closed`};function t(e,t){if(t.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:t.method,tx:t.tx,retryTargetForFailure:{kind:`fresh`}}};if(t.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:t.method,tx:t.tx}};if(t.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...t.tx?{tx:t.tx}:{}}};switch(e.name){case`closed`:return n(t);case`deposit`:return r(e,t);case`assetPicker`:return i(e,t);case`amountEntry`:return a(e,t);case`confirmDeposit`:return o(e,t);case`transferCrypto`:return s(e,t);case`processing`:return c(e,t);case`success`:return l(e,t);case`error`:return u(e,t);default:return f(e)}}function n(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function r(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function i(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function a(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function o(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function s(e,t){switch(t.type){case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function u(e,t){return t.type===`ERROR_TRY_AGAIN`?d(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function d(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}function f(e){throw Error(`Unhandled state: ${JSON.stringify(e)}`)}export{e as initialState,t as reducer};
1
+ import{createActivityReducers as e}from"../../../shared/orchestrator/createActivityReducers.js";import"../../../shared/orchestrator/index.js";import{assertNever as t}from"../../../shared/utils/assertNever.js";const n={name:`closed`},{reduceFromActivityList:r,reduceFromActivityDetail:i}=e({activityList:e=>({name:`activityList`,ctx:{backTarget:e}}),activityDetail:(e,t,n)=>({name:`activityDetail`,ctx:{settlementId:e,backTarget:t,viaList:n}}),closed:()=>({name:`closed`}),restoreFromBackTarget:e=>_(e)});function a(e,n){if(n.type===`RESUME_TO_PROCESSING`)return e.name===`closed`?e:{name:`processing`,ctx:{method:n.method,tx:n.tx,retryTargetForFailure:{kind:`fresh`}}};if(n.type===`RESUME_TO_SUCCESS`)return e.name===`closed`?e:{name:`success`,ctx:{method:n.method,tx:n.tx}};if(n.type===`RESUME_TO_ERROR`)return e.name===`closed`?e:{name:`error`,ctx:{retryTarget:{kind:`fresh`},...n.tx?{tx:n.tx}:{}}};switch(e.name){case`closed`:return o(n);case`deposit`:return s(e,n);case`assetPicker`:return c(e,n);case`amountEntry`:return l(e,n);case`cashAmountEntry`:return u(e,n);case`cashConfirm`:return d(e,n);case`confirmDeposit`:return f(e,n);case`transferCrypto`:return p(e,n);case`processing`:return m(e,n);case`success`:return h(e,n);case`error`:return g(e,n);case`activityList`:return r(e,n);case`activityDetail`:return i(e,n);default:return t(e)}}function o(e){if(e.type!==`OPEN`)return{name:`closed`};let t=e.input;return t?t.method===`transfer`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`closed`}}:t.asset?{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`closed`}}:{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`closed`}}:{name:`deposit`,ctx:{backTarget:`closed`}}}function s(e,t){switch(t.type){case`DEPOSIT_METHOD_SELECTED`:return t.method===`wallet`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:`deposit`}};case`CASH_METHOD_SELECTED`:return{name:`cashAmountEntry`,ctx:{method:`cash`,cashMethod:t.cashMethod,backTarget:`deposit`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`deposit`,backTarget:`closed`}}};case`BACK`:case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`ASSET_CONFIRMED`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:t.asset,backTarget:`assetPicker`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`assetPicker`,method:`wallet`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){switch(t.type){case`AMOUNT_CONFIRMED`:return{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.ctx.asset,amount:t.amount,phase:{kind:`loading`},backTarget:`amountEntry`}};case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`amountEntry`,method:`wallet`,asset:e.ctx.asset,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:`deposit`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`CASH_AMOUNT_CONFIRMED`:return{name:`cashConfirm`,ctx:{method:`cash`,cashMethod:e.ctx.cashMethod,amount:t.amount,phase:{kind:`loading`},backTarget:`cashAmountEntry`}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function d(e,t){let n=e.ctx.phase;switch(t.type){case`CASH_METHOD_READY`:return n.kind===`loading`?{...e,ctx:{...e.ctx,phase:{kind:`ready`}}}:e;case`BACK`:return{name:`cashAmountEntry`,ctx:{method:`cash`,cashMethod:e.ctx.cashMethod,backTarget:`deposit`,amount:e.ctx.amount}};case`CLOSE`:return{name:`closed`};default:return e}}function f(e,t){let n=e.ctx.phase;switch(t.type){case`QUOTE_RESOLVED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`ready`,quoteExpiresAt:t.expiresAt}}}:e;case`QUOTE_FAILED`:return n.kind===`loading`||n.kind===`regenerating`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`quote`}}}:e;case`QUOTE_RETRY`:return n.kind===`failed`?{...e,ctx:{...e.ctx,phase:{kind:`loading`}}}:e;case`QUOTE_EXPIRED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`}}}:e;case`DEPOSIT_CONFIRMED`:return n.kind===`ready`?{...e,ctx:{...e.ctx,phase:{kind:`submitting`}}}:e;case`DEPOSIT_SUBMITTED`:if(n.kind===`submitting`){let n={kind:`confirmDepositReady`,method:`wallet`,asset:e.ctx.asset,amount:e.ctx.amount};return{name:`processing`,ctx:{method:`wallet`,tx:t.tx,retryTargetForFailure:n}}}return e;case`DEPOSIT_SUBMISSION_FAILED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`failed`,failure:t.failure,recoverFrom:`submission`}}}:e;case`DEPOSIT_SIGNATURE_DECLINED`:return n.kind===`submitting`?{...e,ctx:{...e.ctx,phase:{kind:`regenerating`,...t.notice?{notice:t.notice}:{}}}}:e;case`BACK`:return{name:`amountEntry`,ctx:{method:`wallet`,asset:e.ctx.asset,backTarget:`assetPicker`}};case`CLOSE`:return{name:`closed`};default:return e}}function p(e,t){switch(t.type){case`OPEN_ACTIVITY`:return{name:`activityList`,ctx:{backTarget:{kind:`transferCrypto`,method:`transfer`,backTarget:e.ctx.backTarget}}};case`BACK`:return e.ctx.backTarget===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:{name:`closed`};case`CLOSE`:return{name:`closed`};default:return e}}function m(e,t){switch(t.type){case`PROCESSING_SUCCEEDED`:return{name:`success`,ctx:{method:e.ctx.method,tx:e.ctx.tx}};case`PROCESSING_FAILED`:return{name:`error`,ctx:{retryTarget:e.ctx.retryTargetForFailure,tx:e.ctx.tx}};case`CLOSE`:return{name:`closed`};default:return e}}function h(e,t){return t.type===`SUCCESS_DONE`||t.type===`CLOSE`?{name:`closed`}:e}function g(e,t){return t.type===`ERROR_TRY_AGAIN`?v(e.ctx.retryTarget):t.type===`CLOSE`?{name:`closed`}:e}function _(e){return e.kind===`deposit`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`assetPicker`?{name:`assetPicker`,ctx:{method:`wallet`,backTarget:e.backTarget}}:e.kind===`amountEntry`?{name:`amountEntry`,ctx:{method:`wallet`,asset:e.asset,backTarget:e.backTarget}}:{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}}function v(e){return e.kind===`fresh`?{name:`deposit`,ctx:{backTarget:`closed`}}:e.kind===`transferCrypto`?{name:`transferCrypto`,ctx:{method:`transfer`,backTarget:e.backTarget}}:{name:`confirmDeposit`,ctx:{method:`wallet`,asset:e.asset,amount:e.amount,phase:{kind:`loading`},backTarget:`amountEntry`}}}export{n as initialState,a as reducer};