@stridge/kit 0.1.0-alpha.5 → 0.1.0-alpha.51

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 (398) hide show
  1. package/README.md +22 -6
  2. package/dist/KitProvider.d.ts +29 -0
  3. package/dist/KitProvider.js +1 -1
  4. package/dist/_internal/drivers/stridge/index.d.ts +3 -2
  5. package/dist/_internal/drivers/stridge/index.js +1 -1
  6. package/dist/_internal/withdraw/driver/index.d.ts +2 -2
  7. package/dist/activity-history/compound/index.d.ts +9 -0
  8. package/dist/activity-history/compound/index.js +1 -0
  9. package/dist/deposit/compound/index.d.ts +4 -3
  10. package/dist/deposit/widgets/index.d.ts +13 -0
  11. package/dist/deposit/widgets/index.js +1 -0
  12. package/dist/drivers/stridge/catalog.d.ts +54 -0
  13. package/dist/drivers/stridge/catalog.js +1 -0
  14. package/dist/drivers/stridge/createStridgeDepositDriver.d.ts +10 -1
  15. package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
  16. package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +37 -14
  17. package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
  18. package/dist/drivers/stridge/internal/ensureWalletChain.js +1 -0
  19. package/dist/drivers/stridge/internal/pollOnce.js +1 -1
  20. package/dist/drivers/stridge/internal/resolveAddEthereumChain.js +1 -0
  21. package/dist/drivers/stridge/internal/retry.js +1 -0
  22. package/dist/drivers/stridge/internal/supportedChains.js +1 -0
  23. package/dist/drivers/stridge/types.d.ts +20 -14
  24. package/dist/drivers/stridge/types.js +1 -1
  25. package/dist/drivers/stridge/wagmiSigner.js +1 -1
  26. package/dist/drivers/stridge-mock/createStridgeMockDriver.d.ts +4 -2
  27. package/dist/drivers/stridge-mock/createStridgeMockDriver.js +1 -1
  28. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +17 -4
  29. package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
  30. package/dist/drivers/stridge-mock/fixtures.d.ts +14 -12
  31. package/dist/drivers/stridge-mock/fixtures.js +1 -1
  32. package/dist/events/bus/createBus.d.ts +7 -0
  33. package/dist/events/bus/createBus.js +1 -0
  34. package/dist/events/bus/flowIdRegistry.d.ts +17 -0
  35. package/dist/events/bus/flowIdRegistry.js +1 -0
  36. package/dist/events/bus/index.js +1 -0
  37. package/dist/events/bus/metadata.js +1 -0
  38. package/dist/events/context.js +1 -0
  39. package/dist/events/emit/index.js +1 -0
  40. package/dist/events/emit/mapFailure.js +1 -0
  41. package/dist/events/emit/useDepositEmissions.js +1 -0
  42. package/dist/events/emit/useKitEmitter.js +1 -0
  43. package/dist/events/emit/useWithdrawEmissions.js +1 -0
  44. package/dist/events/hooks/index.d.ts +6 -0
  45. package/dist/events/hooks/index.js +1 -0
  46. package/dist/events/hooks/useCurrentFlowId.d.ts +6 -0
  47. package/dist/events/hooks/useCurrentFlowId.js +1 -0
  48. package/dist/events/hooks/useStableHandler.js +1 -0
  49. package/dist/events/hooks/useStridgeEvent.d.ts +8 -0
  50. package/dist/events/hooks/useStridgeEvent.js +1 -0
  51. package/dist/events/hooks/useStridgeEventBus.d.ts +33 -0
  52. package/dist/events/hooks/useStridgeEventBus.js +1 -0
  53. package/dist/events/hooks/useStridgeEvents.d.ts +6 -0
  54. package/dist/events/hooks/useStridgeEvents.js +1 -0
  55. package/dist/events/hooks/useStridgeFlowEvent.d.ts +8 -0
  56. package/dist/events/hooks/useStridgeFlowEvent.js +1 -0
  57. package/dist/events/hooks/useStridgeFlowEvents.d.ts +6 -0
  58. package/dist/events/hooks/useStridgeFlowEvents.js +1 -0
  59. package/dist/events/index.d.ts +14 -0
  60. package/dist/events/index.js +1 -0
  61. package/dist/events/publish.js +1 -0
  62. package/dist/events/types/deposit.d.ts +235 -0
  63. package/dist/events/types/envelope.d.ts +145 -0
  64. package/dist/events/types/index.d.ts +31 -0
  65. package/dist/events/types/kit.d.ts +23 -0
  66. package/dist/events/types/withdraw.d.ts +150 -0
  67. package/dist/flows/deposit/dialog/DepositDialog.d.ts +20 -82
  68. package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
  69. package/dist/flows/deposit/dialog/WalletRequiredState.js +1 -0
  70. package/dist/flows/deposit/dialog/WalletRequiredState.styles.js +1 -0
  71. package/dist/flows/deposit/driver/payloads.d.ts +17 -4
  72. package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.d.ts +2 -0
  73. package/dist/flows/deposit/driver/transformers/balanceToBalancesPayload.js +1 -1
  74. package/dist/flows/deposit/driver/transformers/index.d.ts +1 -0
  75. package/dist/flows/deposit/driver/transformers/quoteToPayload.d.ts +2 -0
  76. package/dist/flows/deposit/driver/transformers/settlementToPayload.d.ts +25 -0
  77. package/dist/flows/deposit/driver/transformers/startToAddressesPayload.d.ts +2 -0
  78. package/dist/flows/deposit/driver/transformers/startToAddressesPayload.js +1 -1
  79. package/dist/flows/deposit/driver/transformers/startToBrandPayload.d.ts +1 -0
  80. package/dist/flows/deposit/driver/transformers/startToTargetPayload.d.ts +2 -0
  81. package/dist/flows/deposit/driver/transformers/startToTargetPayload.js +1 -1
  82. package/dist/flows/deposit/driver/transformers/walletAddressToWalletPayload.d.ts +1 -0
  83. package/dist/flows/deposit/driver/types.d.ts +64 -3
  84. package/dist/flows/deposit/orchestrator/controller.js +1 -1
  85. package/dist/flows/deposit/orchestrator/reducer.js +1 -1
  86. package/dist/flows/deposit/orchestrator/types.d.ts +103 -1
  87. package/dist/flows/deposit/orchestrator/useDeposit.d.ts +45 -1
  88. package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
  89. package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.d.ts +40 -0
  90. package/dist/flows/deposit/widgets/activity-history/DepositHistoryDetail.js +1 -0
  91. package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.d.ts +38 -0
  92. package/dist/flows/deposit/widgets/activity-history/DepositHistoryList.js +1 -0
  93. package/dist/flows/deposit/widgets/activity-history/index.d.ts +2 -0
  94. package/dist/flows/deposit/widgets/activity-history/index.js +1 -0
  95. package/dist/flows/deposit/widgets/activity-history/useDepositActivityHistorySource.js +1 -0
  96. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.d.ts +32 -5
  97. package/dist/flows/deposit/widgets/amount-entry/AmountEntry.js +1 -1
  98. package/dist/flows/deposit/widgets/amount-entry/footerIntent.js +1 -0
  99. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.d.ts +22 -4
  100. package/dist/flows/deposit/widgets/asset-picker/AssetPicker.js +1 -1
  101. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.d.ts +37 -4
  102. package/dist/flows/deposit/widgets/confirm-deposit/ConfirmDeposit.js +1 -1
  103. package/dist/flows/deposit/widgets/deposit/Deposit.d.ts +33 -4
  104. package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
  105. package/dist/flows/deposit/widgets/deposit/compound/Deposit.d.ts +32 -0
  106. package/dist/flows/deposit/widgets/deposit/compound/Deposit.js +1 -1
  107. package/dist/flows/deposit/widgets/deposit/compound/Deposit.styles.js +1 -1
  108. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.d.ts +29 -0
  109. package/dist/flows/deposit/widgets/deposit/compound/components/Boundary.js +1 -0
  110. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.d.ts +28 -0
  111. package/dist/flows/deposit/widgets/deposit/compound/components/Guards.js +1 -0
  112. package/dist/flows/deposit/widgets/deposit/compound/components/Header.d.ts +10 -0
  113. package/dist/flows/deposit/widgets/deposit/compound/components/Header.js +1 -1
  114. package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +6 -0
  115. package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
  116. package/dist/flows/deposit/widgets/deposit/compound/components/Steps.d.ts +24 -0
  117. package/dist/flows/deposit/widgets/deposit/compound/components/Steps.js +1 -0
  118. package/dist/flows/deposit/widgets/deposit/compound/index.d.ts +1 -0
  119. package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +6 -3
  120. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +41 -1
  121. package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
  122. package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
  123. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
  124. package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
  125. package/dist/flows/deposit/widgets/deposit-status-banner/compound/types.d.ts +5 -5
  126. package/dist/flows/deposit/widgets/error-state/ErrorState.d.ts +39 -4
  127. package/dist/flows/deposit/widgets/error-state/ErrorState.js +1 -1
  128. package/dist/flows/deposit/widgets/processing-state/ProcessingState.d.ts +30 -4
  129. package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
  130. package/dist/flows/deposit/widgets/success-state/SuccessState.d.ts +38 -4
  131. package/dist/flows/deposit/widgets/success-state/SuccessState.js +1 -1
  132. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.d.ts +34 -3
  133. package/dist/flows/deposit/widgets/transfer-crypto/TransferCrypto.js +1 -1
  134. package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.d.ts +1 -1
  135. package/dist/flows/deposit/widgets/transfer-crypto/compound/TransferCrypto.styles.js +1 -1
  136. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
  137. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +5 -2
  138. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
  139. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.d.ts +5 -0
  140. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Header.js +1 -1
  141. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
  142. package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
  143. package/dist/flows/deposit/widgets/transfer-crypto/compound/types.d.ts +16 -2
  144. package/dist/flows/shared/transformers/computeQuoteAttrs.d.ts +1 -0
  145. package/dist/flows/shared/transformers/index.d.ts +1 -0
  146. package/dist/flows/shared/transformers/pickRelevantSettlement.d.ts +1 -0
  147. package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
  148. package/dist/flows/shared/transformers/testnets.js +1 -0
  149. package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
  150. package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
  151. package/dist/flows/withdraw/bindings/index.d.ts +1 -0
  152. package/dist/flows/withdraw/bindings/index.js +1 -0
  153. package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +35 -71
  154. package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
  155. package/dist/flows/withdraw/driver/dto.d.ts +8 -7
  156. package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
  157. package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
  158. package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
  159. package/dist/flows/withdraw/driver/types.d.ts +111 -14
  160. package/dist/flows/withdraw/orchestrator/controller.js +1 -1
  161. package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
  162. package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
  163. package/dist/flows/withdraw/orchestrator/types.d.ts +201 -32
  164. package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +36 -1
  165. package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
  166. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.d.ts +39 -0
  167. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryDetail.js +1 -0
  168. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.d.ts +36 -0
  169. package/dist/flows/withdraw/widgets/activity-history/WithdrawHistoryList.js +1 -0
  170. package/dist/flows/withdraw/widgets/activity-history/index.d.ts +2 -0
  171. package/dist/flows/withdraw/widgets/activity-history/index.js +1 -0
  172. package/dist/flows/withdraw/widgets/activity-history/useWithdrawActivityHistorySource.js +1 -0
  173. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.d.ts +60 -0
  174. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.js +1 -0
  175. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.d.ts +13 -0
  176. package/dist/flows/withdraw/widgets/withdraw/compound/Withdraw.slots.js +1 -0
  177. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.d.ts +29 -0
  178. package/dist/flows/withdraw/widgets/withdraw/compound/components/Boundary.js +1 -0
  179. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.d.ts +25 -0
  180. package/dist/flows/withdraw/widgets/withdraw/compound/components/Guards.js +1 -0
  181. package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.d.ts +27 -0
  182. package/dist/flows/withdraw/widgets/withdraw/compound/components/Steps.js +1 -0
  183. package/dist/flows/withdraw/widgets/withdraw/compound/index.d.ts +3 -0
  184. package/dist/flows/withdraw/widgets/withdraw/compound/index.js +1 -0
  185. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.d.ts +45 -2
  186. package/dist/flows/withdraw/widgets/withdraw-error/WithdrawError.js +1 -1
  187. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.d.ts +32 -12
  188. package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
  189. package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
  190. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.d.ts +6 -1
  191. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/Header.js +1 -1
  192. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
  193. package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
  194. package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
  195. package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
  196. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +39 -3
  197. package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
  198. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.d.ts +46 -2
  199. package/dist/flows/withdraw/widgets/withdraw-success/WithdrawSuccess.js +1 -1
  200. package/dist/i18n/index.d.ts +5 -4
  201. package/dist/i18n/index.js +1 -1
  202. package/dist/i18n/locales/ar.js +1 -1
  203. package/dist/i18n/locales/es.js +1 -1
  204. package/dist/i18n/locales/source-keys.d.ts +12 -0
  205. package/dist/i18n/locales/source-keys.js +0 -0
  206. package/dist/icons/index.d.ts +3 -1
  207. package/dist/icons/index.js +1 -1
  208. package/dist/index.d.ts +22 -9
  209. package/dist/index.js +1 -1
  210. package/dist/package.js +1 -1
  211. package/dist/scope/KitPortalScope.js +1 -1
  212. package/dist/scope/KitScope.d.ts +18 -1
  213. package/dist/scope/KitScope.js +1 -1
  214. package/dist/scope/context.d.ts +17 -1
  215. package/dist/scope/index.d.ts +1 -1
  216. package/dist/shared/attribution/Attribution.js +1 -0
  217. package/dist/shared/attribution/Attribution.slots.js +1 -0
  218. package/dist/shared/attribution/Attribution.styles.js +1 -0
  219. package/dist/shared/attribution/index.js +1 -0
  220. package/dist/shared/chains/index.d.ts +48 -29
  221. package/dist/shared/chains/index.js +1 -1
  222. package/dist/shared/constants/brand-intercom.js +1 -0
  223. package/dist/shared/cuer/Cuer.js +1 -1
  224. package/dist/shared/dialog/Frame.js +1 -1
  225. package/dist/shared/dialog/LoadingState.js +1 -0
  226. package/dist/shared/dialog/LoadingState.styles.js +1 -0
  227. package/dist/shared/dialog/StepTransition.js +1 -1
  228. package/dist/shared/dialog/useDirectionalChevronTransform.js +1 -1
  229. package/dist/shared/driver/types.d.ts +4 -3
  230. package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
  231. package/dist/shared/i18n/KitI18nProvider.js +1 -1
  232. package/dist/shared/i18n/createKitI18n.d.ts +79 -16
  233. package/dist/shared/i18n/createKitI18n.js +1 -1
  234. package/dist/shared/i18n/useLingui.d.ts +11 -3
  235. package/dist/shared/icons/HistoryIcon.d.ts +12 -0
  236. package/dist/shared/icons/HistoryIcon.js +1 -0
  237. package/dist/shared/icons/LogoIcon.d.ts +13 -0
  238. package/dist/shared/icons/LogoIcon.js +1 -0
  239. package/dist/shared/merchant-link/MerchantLink.d.ts +1 -0
  240. package/dist/shared/merchant-link/MerchantLink.js +1 -0
  241. package/dist/shared/merchant-link/MerchantLinkButton.d.ts +1 -0
  242. package/dist/shared/merchant-link/MerchantLinkButton.js +1 -0
  243. package/dist/shared/merchant-link/index.d.ts +1 -0
  244. package/dist/shared/merchant-link/index.js +1 -0
  245. package/dist/shared/merchant-link/resolveMerchantLink.js +1 -0
  246. package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
  247. package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
  248. package/dist/shared/support/SupportConfigContext.d.ts +1 -0
  249. package/dist/shared/support/SupportConfigContext.js +1 -0
  250. package/dist/shared/support/SupportLink.d.ts +1 -0
  251. package/dist/shared/support/SupportLink.js +1 -0
  252. package/dist/shared/support/SupportSpinner.d.ts +1 -0
  253. package/dist/shared/support/SupportSpinner.js +1 -0
  254. package/dist/shared/support/index.d.ts +2 -0
  255. package/dist/shared/support/index.js +1 -0
  256. package/dist/shared/support/intercom-loader.d.ts +17 -0
  257. package/dist/shared/support/intercom-loader.js +1 -0
  258. package/dist/shared/support/types.d.ts +43 -0
  259. package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
  260. package/dist/shared/support/useIntercomMerchantContext.js +1 -0
  261. package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
  262. package/dist/shared/support/useMerchantContext.d.ts +1 -0
  263. package/dist/shared/support/useMerchantContext.js +1 -0
  264. package/dist/shared/support/useSupportTrigger.js +1 -0
  265. package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
  266. package/dist/shared/terms/TermsConfigContext.js +1 -0
  267. package/dist/shared/terms/TermsLink.d.ts +1 -0
  268. package/dist/shared/terms/TermsLink.js +1 -0
  269. package/dist/shared/terms/index.d.ts +1 -0
  270. package/dist/shared/terms/index.js +1 -0
  271. package/dist/shared/terms/types.d.ts +43 -0
  272. package/dist/shared/ui/Card/Card.styles.js +1 -1
  273. package/dist/shared/ui/Details/Details.d.ts +9 -1
  274. package/dist/shared/ui/Details/Details.styles.js +1 -1
  275. package/dist/shared/ui/Dialog/Dialog.js +1 -1
  276. package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
  277. package/dist/shared/ui/Select/Select.js +1 -1
  278. package/dist/shared/ui/SelectableTile/SelectableTile.d.ts +21 -8
  279. package/dist/shared/ui/SelectableTile/SelectableTile.js +1 -1
  280. package/dist/shared/ui/Steps/Steps.d.ts +52 -0
  281. package/dist/shared/ui/Steps/Steps.js +1 -0
  282. package/dist/shared/ui/Steps/Steps.slots.d.ts +7 -0
  283. package/dist/shared/ui/Steps/Steps.slots.js +1 -0
  284. package/dist/shared/ui/Steps/Steps.styles.js +1 -0
  285. package/dist/shared/ui/Steps/index.d.ts +2 -0
  286. package/dist/shared/ui/Steps/index.js +1 -0
  287. package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
  288. package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
  289. package/dist/shared/utils/logos/types.d.ts +1 -1
  290. package/dist/shared/utils/useDeepMemo.js +1 -0
  291. package/dist/shared/wallet/ConnectWalletContext.d.ts +17 -0
  292. package/dist/shared/wallet/ConnectWalletContext.js +1 -0
  293. package/dist/shared/widgets/activity-history/ActivityTrigger.js +1 -0
  294. package/dist/shared/widgets/activity-history/ActivityTrigger.styles.js +1 -0
  295. package/dist/shared/widgets/activity-history/adapters/settlementToWidgetProps.js +1 -0
  296. package/dist/shared/widgets/activity-history/compound/ActivityHistory.d.ts +95 -0
  297. package/dist/shared/widgets/activity-history/compound/ActivityHistory.js +1 -0
  298. package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.d.ts +22 -0
  299. package/dist/shared/widgets/activity-history/compound/ActivityHistory.slots.js +1 -0
  300. package/dist/shared/widgets/activity-history/compound/ActivityHistory.styles.js +1 -0
  301. package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.d.ts +75 -0
  302. package/dist/shared/widgets/activity-history/compound/ActivityHistoryDetail.js +1 -0
  303. package/dist/shared/widgets/activity-history/compound/Row.slots.d.ts +21 -0
  304. package/dist/shared/widgets/activity-history/compound/Row.slots.js +1 -0
  305. package/dist/shared/widgets/activity-history/compound/Row.styles.js +1 -0
  306. package/dist/shared/widgets/activity-history/compound/components/Empty.d.ts +15 -0
  307. package/dist/shared/widgets/activity-history/compound/components/Empty.js +1 -0
  308. package/dist/shared/widgets/activity-history/compound/components/ErrorView.d.ts +26 -0
  309. package/dist/shared/widgets/activity-history/compound/components/ErrorView.js +1 -0
  310. package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.d.ts +39 -0
  311. package/dist/shared/widgets/activity-history/compound/components/HistoryHeader.js +1 -0
  312. package/dist/shared/widgets/activity-history/compound/components/List.d.ts +23 -0
  313. package/dist/shared/widgets/activity-history/compound/components/List.js +1 -0
  314. package/dist/shared/widgets/activity-history/compound/components/Row.d.ts +54 -0
  315. package/dist/shared/widgets/activity-history/compound/components/Row.js +1 -0
  316. package/dist/shared/widgets/activity-history/compound/components/StatusPip.js +1 -0
  317. package/dist/shared/widgets/activity-history/compound/context.d.ts +79 -0
  318. package/dist/shared/widgets/activity-history/compound/context.js +1 -0
  319. package/dist/shared/widgets/activity-history/index.js +1 -0
  320. package/dist/shared/widgets/activity-history/payloads.d.ts +81 -0
  321. package/dist/shared/widgets/activity-history/transformers/historyResponseToPayload.js +1 -0
  322. package/dist/shared/widgets/activity-history/transformers/resolveDirection.js +1 -0
  323. package/dist/shared/widgets/amount-entry/compound/AmountEntry.d.ts +4 -1
  324. package/dist/shared/widgets/amount-entry/compound/AmountEntry.js +1 -1
  325. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.d.ts +1 -0
  326. package/dist/shared/widgets/amount-entry/compound/AmountEntry.slots.js +1 -1
  327. package/dist/shared/widgets/amount-entry/compound/AmountEntry.styles.js +1 -1
  328. package/dist/shared/widgets/amount-entry/compound/components/Header.d.ts +6 -1
  329. package/dist/shared/widgets/amount-entry/compound/components/Header.js +1 -1
  330. package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
  331. package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
  332. package/dist/shared/widgets/amount-entry/compound/components/Notice.d.ts +7 -0
  333. package/dist/shared/widgets/amount-entry/compound/components/Notice.js +1 -0
  334. package/dist/shared/widgets/amount-entry/compound/types.d.ts +26 -1
  335. package/dist/shared/widgets/asset-picker/compound/AssetPicker.js +1 -1
  336. package/dist/shared/widgets/asset-picker/compound/AssetPicker.styles.js +1 -1
  337. package/dist/shared/widgets/asset-picker/compound/components/Asset.d.ts +7 -1
  338. package/dist/shared/widgets/asset-picker/compound/components/Asset.js +1 -1
  339. package/dist/shared/widgets/asset-picker/compound/components/Header.d.ts +6 -1
  340. package/dist/shared/widgets/asset-picker/compound/components/Header.js +1 -1
  341. package/dist/shared/widgets/asset-picker/compound/types.d.ts +14 -0
  342. package/dist/shared/widgets/confirm-transfer/compound/ConfirmTransfer.styles.js +1 -1
  343. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
  344. package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
  345. package/dist/shared/widgets/confirm-transfer/compound/components/QuoteTimer.js +1 -1
  346. package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
  347. package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
  348. package/dist/shared/widgets/error-state/compound/components/MoreDetails.d.ts +1 -1
  349. package/dist/shared/widgets/error-state/compound/components/MoreDetails.js +1 -1
  350. package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
  351. package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
  352. package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
  353. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
  354. package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
  355. package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
  356. package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
  357. package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
  358. package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
  359. package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
  360. package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +14 -7
  361. package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
  362. package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
  363. package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
  364. package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
  365. package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
  366. package/dist/shared/widgets/processing-state/compound/types.d.ts +11 -29
  367. package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
  368. package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
  369. package/dist/shared/widgets/success-state/compound/components/MoreDetails.d.ts +1 -1
  370. package/dist/shared/widgets/success-state/compound/components/MoreDetails.js +1 -1
  371. package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
  372. package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
  373. package/dist/shared/widgets/success-state/compound/types.d.ts +5 -5
  374. package/dist/stridge/StridgeProvider.d.ts +165 -35
  375. package/dist/stridge/StridgeProvider.js +1 -1
  376. package/dist/stridge/depositOwner.js +1 -0
  377. package/dist/stridge/optionalWagmi.js +1 -0
  378. package/dist/stridge/stubs.js +1 -1
  379. package/dist/styles/index.css +228 -10
  380. package/dist/types.d.ts +5 -4
  381. package/dist/ui/index.d.ts +3 -1
  382. package/dist/ui/index.js +1 -1
  383. package/dist/withdraw/compound/index.d.ts +5 -2
  384. package/dist/withdraw/compound/index.js +1 -1
  385. package/dist/withdraw/dialog/index.d.ts +3 -1
  386. package/dist/withdraw/widgets/index.d.ts +7 -0
  387. package/dist/withdraw/widgets/index.js +1 -0
  388. package/package.json +23 -7
  389. package/dist/_internal/deposit/widgets/index.d.ts +0 -11
  390. package/dist/_internal/deposit/widgets/index.js +0 -1
  391. package/dist/_internal/withdraw/widgets/index.d.ts +0 -5
  392. package/dist/_internal/withdraw/widgets/index.js +0 -1
  393. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.d.ts +0 -36
  394. package/dist/flows/withdraw/dialog/WithdrawDialogEventsContext.js +0 -1
  395. package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
  396. package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
  397. package/dist/stridge/StridgeContext.d.ts +0 -29
  398. package/dist/stridge/StridgeContext.js +0 -1
@@ -1,102 +1,66 @@
1
- import { TxRef } from "../../../shared/driver/types.js";
2
- import { WithdrawalQuotePayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "../driver/payloads.js";
3
- import { SubmitWithdrawalInput } from "../driver/types.js";
4
- import { FailureInfo } from "../../../shared/orchestrator/types.js";
5
- import { WithdrawStateName } from "../orchestrator/types.js";
6
- import { WithdrawFormEventCallbacks } from "./WithdrawDialogEventsContext.js";
1
+ import { WithdrawSubmitCallback } from "../orchestrator/types.js";
2
+ import { WithdrawBalanceInput, WithdrawSuggestedRecipient } from "../bindings/WithdrawBindings.js";
7
3
  import { ErrorInfo } from "react";
8
4
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
9
5
 
10
6
  //#region src/flows/withdraw/dialog/WithdrawDialog.d.ts
11
7
  /**
12
- * Top-level withdraw dialog. Mounts inside `<KitProvider withdraw={…} />` once at the host's
13
- * app root and binds open state to the controller's `state.name !== "closed"`.
8
+ * Top-level withdraw dialog. Mounts inside `<StridgeProvider>` and binds open state to the
9
+ * controller's `state.name !== "closed"`.
14
10
  *
15
11
  * Body switch is keyed off the orchestrator's *effective* state (not logical state) so the
16
12
  * widget the user was looking at stays mounted through the dialog's close animation.
17
13
  *
18
- * Three top-level callbacks (`onOpened`, `onClosed`, `onStepChanged`) describe the dialog as a
19
- * stateful component. The grouped `events={{ }}` prop carries the operational lifecycle —
20
- * form-level inputs, quote / submit / settlement transitions for the active withdrawal.
14
+ * Lifecycle observability is delivered by the unified event bus exported from
15
+ * `@stridge/kit/events`. The dialog takes no `on*` callback props; subscribe via
16
+ * `useStridgeFlowEvents` / `useStridgeEvents` for analytics or behavioural reactions.
17
+ * `onSubmit` is the host contract — its return value drives the FSM, distinct from any bus
18
+ * event.
21
19
  */
22
20
  declare function WithdrawDialog({
23
21
  container,
22
+ metadata,
24
23
  onError,
25
- onOpened,
26
- onClosed,
27
- onStepChanged,
28
- events
24
+ balance,
25
+ onSubmit,
26
+ suggestedRecipient
29
27
  }?: WithdrawDialog.Props): _$react_jsx_runtime0.JSX.Element;
30
28
  declare namespace WithdrawDialog {
31
29
  interface Props {
32
30
  /**
33
31
  * Element the dialog portals into. Defaults to `document.body` (full-page overlay).
34
- * Pass a transformed ancestor with `overflow: clip` — e.g. a mobile mockup frame — to
35
- * scope the dialog's width, height, and backdrop to that rect.
36
32
  */
37
33
  container?: HTMLElement | null;
34
+ /**
35
+ * Consumer-attached metadata that rides along on every bus event emitted from this
36
+ * dialog's session. Snapshotted at `withdraw.opened` and frozen for the session.
37
+ */
38
+ metadata?: Record<string, unknown>;
38
39
  /** Forwarded to the dialog's internal {@link GatewayKitBoundary} for crash reporting. */
39
40
  onError?: (error: Error, errorInfo: ErrorInfo) => void;
40
41
  /**
41
- * Fires once when the dialog transitions from `closed` to any open step. The withdraw
42
- * flow has no `open({ method })` overload `onOpened` carries no payload.
42
+ * Withdrawable balance to display in the form. Either a bare amount in display units
43
+ * (kit short-circuits USD to $1 for known stablecoins) or `{ amount, amountUsd? }`
44
+ * with an explicit pre-computed USD value. Pass `undefined` while loading; the form
45
+ * renders a skeleton until a value arrives.
43
46
  */
44
- onOpened?: () => void;
45
- /** Fires once when the dialog transitions back to `closed`. `atStep` is the last open step. */
46
- onClosed?: (atStep: WithdrawStateName) => void;
47
- /** Fires on every logical step transition. */
48
- onStepChanged?: (event: {
49
- from: WithdrawStateName;
50
- to: WithdrawStateName;
51
- }) => void;
47
+ balance?: WithdrawBalanceInput;
52
48
  /**
53
- * Operational eventsuser actions, quote / submit / settlement transitions for the
54
- * active withdrawal. Each callback is optional and fires after the controller has acted
55
- * (state machine has transitioned, driver entity has settled), so payloads are guaranteed
56
- * valid for the named event.
49
+ * Submit handlerfires once the kit has prepared a fresh UDA target for the
50
+ * withdrawal. The host's backend is responsible for broadcasting a transfer of the
51
+ * brand currency to that UDA; the kit hands a `WithdrawSubmitActions` handle the host
52
+ * calls (`beginProcessing` / `setTxHash` / `succeed` / `fail` / `decline`) to advance
53
+ * the FSM. Required when the dialog is used — a missing callback lands the user on
54
+ * the error screen instead of an infinite spinner. This is a contract, not a bus
55
+ * event: return value drives the FSM.
57
56
  */
58
- events?: Events;
59
- }
60
- /**
61
- * Operational lifecycle hooks. Splits cleanly into:
62
- *
63
- * - **Form-level inputs** (`onRecipientChanged` / `onAmountChanged` / `onReceiveTokenChanged`
64
- * / `onReceiveChainChanged`) — fire on every change of the form's local state.
65
- * - **User actions** (`onWithdrawalConfirmed`) — fire when the user submits the form.
66
- * - **Quote lifecycle** — track the form's quote entity through `loading → ready / error`.
67
- * - **Submit lifecycle** — track the wagmi-driven broadcast through wagmi → receipt → terminal
68
- * verdict.
69
- * - **Settlement entity** — track the gateway's settlement payload through pending / succeeded /
70
- * failed.
71
- */
72
- interface Events extends WithdrawFormEventCallbacks {
73
- /** User submitted the form (the SUBMIT action — wallet prompt is about to fire). */
74
- onWithdrawalConfirmed?: () => void;
75
- /** Quote entity reached `ready` with the formatted payload. */
76
- onQuoteResolved?: (quote: WithdrawalQuotePayload) => void;
77
- /** Quote entity reached `error`. */
78
- onQuoteFailed?: (failure: {
79
- reason: string;
80
- code?: string;
81
- }) => void;
82
- /** Wagmi broadcast completed and the orchestrator transitioned into `inProgress`. */
83
- onWithdrawalSubmitted?: (event: {
84
- input: SubmitWithdrawalInput;
85
- tx: TxRef;
86
- }) => void;
87
- /** User declined the wallet signature prompt; orchestrator transitioned into `error`. */
88
- onSignatureDeclined?: () => void;
89
- /** Submission failed for a non-rejection reason (network, bad input, etc). */
90
- onSubmissionFailed?: (failure: FailureInfo) => void;
91
- /** The driver's `settlement` entity emitted a progressive pending update. */
92
- onProcessingProgress?: (update: WithdrawalSettlementPendingPayload) => void;
93
- /** Terminal success — settlement entity reached `ready{kind: "succeeded"}`. */
94
- onSucceeded?: (result: WithdrawalSettlementSuccessPayload) => void;
57
+ onSubmit?: WithdrawSubmitCallback;
95
58
  /**
96
- * Terminal failure either a settlement-driven failure (driver-emitted classification) or
97
- * an FSM-derived failure (submission rejection escalated to the global error arm).
59
+ * Trusted recipient address surfaced as a one-click prefill chip next to the
60
+ * recipient input. The kit no longer auto-derives this from `wagmi.address`. Pass an
61
+ * explicit address you trust the user wants to fill with. Omit to hide the chip.
98
62
  */
99
- onFailed?: (failure: WithdrawalSettlementFailurePayload | FailureInfo) => void;
63
+ suggestedRecipient?: WithdrawSuggestedRecipient;
100
64
  }
101
65
  }
102
66
  //#endregion
@@ -1 +1 @@
1
- "use client";import{useDialogLifecycle as e}from"../../../shared/orchestrator/useDialogLifecycle.js";import"../../../shared/orchestrator/index.js";import{useWithdrawSnapshot as t}from"../driver/context.js";import{useWithdrawEffectiveState as n,useWithdrawState as r}from"../orchestrator/controller.js";import{useWithdraw as i}from"../orchestrator/useWithdraw.js";import"../orchestrator/index.js";import{Dialog as a}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{StepTransition as o}from"../../../shared/dialog/StepTransition.js";import{GatewayKitBoundary as s}from"../../../shared/error-handling/components/GatewayKitBoundary.js";import"../../../shared/error-handling/index.js";import{WithdrawError as c}from"../widgets/withdraw-error/WithdrawError.js";import{WithdrawDialogEventsProvider as l}from"./WithdrawDialogEventsContext.js";import{WithdrawForm as u}from"../widgets/withdraw-form/WithdrawForm.js";import{WithdrawInProgress as d}from"../widgets/withdraw-in-progress/WithdrawInProgress.js";import{WithdrawSuccess as f}from"../widgets/withdraw-success/WithdrawSuccess.js";import"../../../_internal/withdraw/widgets/index.js";import{useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";function g({container:e,onError:p,onOpened:g,onClosed:v,onStepChanged:y,events:b}={}){let x=r(),S=n(),{close:C}=i(),w=t(),T=x.name!==`closed`;_(x,w.settlement,w.quote,{onOpened:g,onClosed:v,onStepChanged:y,events:b});let E=S.name===`submitting`?`form`:S.name;return m(a,{open:T,onOpenChange:e=>e?void 0:C(),children:m(a.Content,{container:e,children:m(s,{onError:p,onReset:C,children:m(l,{events:b??{},children:h(o,{stateKey:E,children:[S.name===`form`||S.name===`submitting`?m(u,{}):null,S.name===`inProgress`?m(d,{}):null,S.name===`success`?m(f,{}):null,S.name===`error`?m(c,{}):null]})})})})})}function _(t,n,r,i){let a=p(i);a.current=i,e({state:t,settlement:n,quote:r,fireFsm:(e,t)=>v(e,t,a.current),fireSettlement:(e,t)=>y(t,a.current),fireQuote:(e,t)=>{if(t.status===e)return;let n=a.current.events;t.status===`ready`&&n?.onQuoteResolved?.(t.payload),t.status===`error`&&n?.onQuoteFailed?.({reason:t.error.message||`Quote failed.`,...t.error.name?{code:t.error.name}:{}})}})}function v(e,t,n){let{onOpened:r,onClosed:i,onStepChanged:a,events:o}=n,s=e.name===`form`&&!!e.ctx?.notice;if(t.name===`form`&&t.ctx?.notice&&!s&&o?.onSignatureDeclined?.(),e.name!==t.name&&(e.name===`closed`&&t.name!==`closed`&&r?.(),e.name!==`closed`&&t.name===`closed`&&i?.(e.name),a?.({from:e.name,to:t.name}),e.name===`form`&&t.name===`submitting`&&o?.onWithdrawalConfirmed?.(),e.name===`submitting`&&t.name===`inProgress`&&o?.onWithdrawalSubmitted?.({input:t.ctx.input,tx:t.ctx.tx}),t.name===`error`)){let e=t.ctx.failure;e!==void 0&&t.ctx.tx===void 0&&e&&(o?.onSubmissionFailed?.(e),o?.onFailed?.(e))}}function y(e,t){if(e.status!==`ready`&&e.status!==`stale`)return;let n=e.payload,r=t.events;if(r){if(n.kind===`pending`){r.onProcessingProgress?.(n);return}if(n.kind===`succeeded`){r.onSucceeded?.(n);return}n.kind===`failed`&&r.onFailed?.(n)}}export{g as WithdrawDialog};
1
+ "use client";import{useWithdrawBindings as e}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawSnapshot as t}from"../driver/context.js";import{useWithdrawState as n}from"../orchestrator/controller.js";import{useWithdraw as r}from"../orchestrator/useWithdraw.js";import"../orchestrator/index.js";import{useWithdrawEmissions as i}from"../../../events/emit/useWithdrawEmissions.js";import"../../../events/emit/index.js";import{useIntercomShutdownOnUnmount as a}from"../../../shared/support/useIntercomShutdownOnUnmount.js";import"../../../shared/support/index.js";import{Dialog as o}from"../../../shared/ui/Dialog/Dialog.js";import"../../../shared/ui/Dialog/index.js";import{Withdraw as s}from"../widgets/withdraw/compound/Withdraw.js";import"../../../withdraw/compound/index.js";import{WithdrawHistoryDetail as c}from"../widgets/activity-history/WithdrawHistoryDetail.js";import{WithdrawHistoryList as l}from"../widgets/activity-history/WithdrawHistoryList.js";import{WithdrawError as u}from"../widgets/withdraw-error/WithdrawError.js";import{WithdrawForm as d}from"../widgets/withdraw-form/WithdrawForm.js";import{WithdrawInProgress as f}from"../widgets/withdraw-in-progress/WithdrawInProgress.js";import{WithdrawSuccess as p}from"../widgets/withdraw-success/WithdrawSuccess.js";import"../../../withdraw/widgets/index.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";function g({container:g,metadata:_,onError:v,balance:y,onSubmit:b,suggestedRecipient:x}={}){let S=n(),{close:C}=r(),w=t(),T=S.name!==`closed`;return i({state:S,settlement:w.settlement,quote:w.quote,metadata:_}),a(),e({...y===void 0?{}:{balance:y},...b?{onSubmit:b}:{},...x?{suggestedRecipient:x}:{}}),m(o,{open:T,onOpenChange:e=>e?void 0:C(),children:m(o.Content,{container:g,children:m(s.Boundary,{...v?{onError:v}:{},children:m(s.Guards,{children:h(s.Steps,{children:[m(s.Step,{name:`form`,children:m(d,{})}),m(s.Step,{name:`inProgress`,children:m(f,{})}),m(s.Step,{name:`success`,children:m(p,{})}),m(s.Step,{name:`error`,children:m(u,{})}),m(s.Step,{name:`historyList`,children:m(l,{})}),m(s.Step,{name:`historyDetail`,children:m(c,{})})]})})})})})}export{g as WithdrawDialog};
@@ -1,4 +1,4 @@
1
- import { GatewayPollResponse, GatewaySettlementDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
1
+ import { GatewaySettlementDto, GatewayUdaDto, OnchainBalanceResponse, QuoteResponse, SupportedAssetDto, SupportedAssetsResponse } from "@stridge/sdk";
2
2
 
3
3
  //#region src/flows/withdraw/driver/dto.d.ts
4
4
  /**
@@ -22,18 +22,19 @@ type WithdrawalQuoteResponse = QuoteResponse;
22
22
  */
23
23
  type WithdrawalSettlementDto = GatewaySettlementDto;
24
24
  /**
25
- * Full `gateway/{owner}` poll response. Carries `destination` plus `settlements[]`. Used as the
26
- * `response` slot on the settlement entity envelope so headless integrators can correlate against
27
- * the UDA-level destination metadata.
25
+ * Per-UDA view from `gateway/{owner}`. Carries the UDA's `destination` plus `settlements[]`. Used
26
+ * as the `response` slot on the settlement entity envelope so headless integrators can correlate
27
+ * against the UDA-level destination metadata. The kit's `pollOnce` boundary picks the matching
28
+ * UDA out of the gateway's multi-UDA envelope before this type is observed downstream.
28
29
  */
29
- type WithdrawalSettlementResponse = GatewayPollResponse;
30
+ type WithdrawalSettlementResponse = GatewayUdaDto;
30
31
  /**
31
- * Per-network entry from `Uda.supportedAssets()`. Surfaced as the `raw` slot on the
32
+ * Per-network entry from `Gateway.assets()`. Surfaced as the `raw` slot on the
32
33
  * `receiveOptions` entity so headless integrators can navigate the catalog without re-fetching.
33
34
  */
34
35
  type ReceiveOptionDto = SupportedAssetDto;
35
36
  /**
36
- * Full `Uda.supportedAssets()` response. Drives the receive chain + receive token dropdowns on
37
+ * Full `Gateway.assets()` response. Drives the receive chain + receive token dropdowns on
37
38
  * the form.
38
39
  */
39
40
  type ReceiveOptionsResponse = SupportedAssetsResponse;
@@ -1,5 +1,7 @@
1
1
  import { SettlementFailureKind } from "../../../shared/driver/types.js";
2
2
  import { FormattedField } from "../../../shared/format/types.js";
3
+ import { ChainType } from "../../../shared/chains/index.js";
4
+
3
5
  //#region src/flows/withdraw/driver/payloads.d.ts
4
6
  /**
5
7
  * Per-asset balance available to withdraw — the brand-managed source the cash-out flow draws
@@ -108,6 +110,12 @@ interface WithdrawalSettlementPendingPayload {
108
110
  kind: "pending";
109
111
  receiveAsset: WithdrawalReceiveAssetPayload;
110
112
  receiveAmount: FormattedField<number>;
113
+ /**
114
+ * USD value of `receiveAmount` at the settlement leg's price snapshot. Sourced from the
115
+ * gateway leg's `amount_usd` (`to` preferred, `from` fallback). Omitted when neither leg
116
+ * carries a priced amount — the in-progress hero then falls back to the quote's USD figure.
117
+ */
118
+ receiveAmountUsd?: FormattedField<number>;
111
119
  /** Recipient address — the destination the user supplied on the form. */
112
120
  recipient: FormattedField<string>;
113
121
  /** Unix-ms timestamp when the withdrawal was submitted. */
@@ -191,8 +199,15 @@ interface ReceiveChainPayload {
191
199
  networkId: string;
192
200
  /** Human-readable network name (e.g. `"Polygon"`). */
193
201
  networkName: string;
194
- /** EIP-155 chain id (numeric). */
202
+ /** EIP-155 chain id (numeric). Only meaningful when `chainType === "evm"`. */
195
203
  eip155Id: number;
204
+ /**
205
+ * Chain family this network belongs to — driver-populated from the gateway's `chain_type`
206
+ * tag. The withdraw form drives recipient-address validation off this so a non-EVM receive
207
+ * chain accepts its own address shape instead of the EVM `0x…` form. Drivers that can't
208
+ * determine the family tag it `"unknown"`, which keeps the address gate permissive.
209
+ */
210
+ chainType: ChainType;
196
211
  /** Resolved chain icon URL — derived from the chain's native_currency.logo. */
197
212
  chainLogoUrl?: string;
198
213
  /**
@@ -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{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=e.to,l=i(r?.confirmed_at)??i(e.created_at)??Date.now(),u=p(t,n),d=m(a,t.destination.asset_decimals)||m(r,r?.asset_decimals??t.destination.asset_decimals),f=t.destination.address,g=r?.tx_id,_=r?.eip155_id===void 0?void 0:Number(r.eip155_id);return{kind:`pending`,receiveAsset:u,receiveAmount:{value:d,formatted:s(d,n.i18n,{maxDecimals:t.destination.asset_decimals})},recipient:{value:f,formatted:c(f)},submittedAt:{value:l,formatted:o(l,n.i18n)},...g?{txHash:{value:g,formatted:c(g)},...h(n,_,g)?{txExplorerUrl:h(n,_,g)}:{}}:{}}}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),_=Math.round(f/1e3),v=p(t,n),y=m(l,t.destination.asset_decimals),b=t.destination.address,x=r?.tx_id??``,S=r?.eip155_id===void 0?void 0:Number(r.eip155_id),C=l?.tx_id,w=h(n,g(l?.eip155_id)??g(t.destination.eip155_id),C);return{kind:`succeeded`,receiveAsset:v,receiveAmount:{value:y,formatted:s(y,n.i18n,{maxDecimals:t.destination.asset_decimals})},recipient:{value:b,formatted:c(b)},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)},totalTime:{value:_,formatted:a(f,n.i18n)},txHash:{value:x,formatted:x?c(x):``},...h(n,S,x)?{txExplorerUrl:h(n,S,x)}:{},...C?{completionTx:{hash:{value:C,formatted:c(C)},...w?{explorerUrl:w}:{}}}:{}}}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=p(n,r),f=n.destination.address,m=a?.tx_id,g=a?.eip155_id===void 0?void 0:Number(a.eip155_id);return{kind:`failed`,failureKind:e(t.error),receiveAsset:d,receiveAmount:{value:0,formatted:s(0,r.i18n)},recipient:{value:f,formatted:c(f)},submittedAt:{value:l,formatted:o(l,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)},...m?{txHash:{value:m,formatted:c(m)},...h(r,g,m)?{txExplorerUrl:h(r,g,m)}:{}}:{}}}function p(e,t){let n=t.receiveAssetEnrichment,r=Number(e.destination.eip155_id);return{symbol:e.destination.asset_symbol,decimals:e.destination.asset_decimals,address:e.destination.asset_address,isNative:!e.destination.asset_address,...n?.assetLogoUrl?{assetLogoUrl:n.assetLogoUrl}:{},networkId:e.destination.network_id,networkName:n?.networkName??e.destination.network_name,...Number.isFinite(r)?{eip155Id:e.destination.eip155_id}:{},...n?.chainLogoUrl?{chainLogoUrl:n.chainLogoUrl}:{}}}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(!n||t===void 0)return;let r=e.explorers?.[t];if(r)return`${r.replace(/\/+$/,``)}/tx/${n}`}function g(e){if(e==null||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}export{l as settlementToWithdrawalPayload};
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{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{formatUsd as c}from"../../../../shared/format/formatUsd.js";import{shortenAddress as l}from"../../../../shared/format/shortenAddress.js";function u(e,n,r){let i=t(e.status);return i===`completed`?f(e,n,r):i===`failed`?p(e,n,r):d(e,n,r)}function d(e,t,r){let a=e.from,u=e.to,d=i(a?.confirmed_at)??i(e.created_at)??Date.now(),f=m(t,r),p=g(u,t,r),v=h(u,p),y=n(u?.amount_usd)||n(a?.amount_usd),b=t.destination.address,x=a?.tx_id,S=a?.eip155_id===void 0?void 0:Number(a.eip155_id);return{kind:`pending`,receiveAsset:f,receiveAmount:{value:v,formatted:s(v,r.i18n,{maxDecimals:p})},...y>0?{receiveAmountUsd:{value:y,formatted:c(y,r.i18n)}}:{},recipient:{value:b,formatted:l(b)},submittedAt:{value:d,formatted:o(d,r.i18n)},...x?{txHash:{value:x,formatted:l(x)},..._(r,S,x)?{txExplorerUrl:_(r,S,x)}:{}}:{}}}function f(e,t,n){let r=e.from,c=e.to,u=i(r?.confirmed_at)??i(e.created_at)??Date.now(),d=i(c?.settled_at)??i(e.updated_at)??Date.now(),f=Math.max(0,d-u),p=Math.round(f/1e3),y=m(t,n),b=g(c,t,n),x=h(c,b),S=t.destination.address,C=r?.tx_id??``,w=r?.eip155_id===void 0?void 0:Number(r.eip155_id),T=c?.tx_id,E=_(n,v(c?.eip155_id)??v(t.destination.eip155_id),T);return{kind:`succeeded`,receiveAsset:y,receiveAmount:{value:x,formatted:s(x,n.i18n,{maxDecimals:b})},recipient:{value:S,formatted:l(S)},submittedAt:{value:u,formatted:o(u,n.i18n)},filledAt:{value:d,formatted:o(d,n.i18n)},totalTime:{value:p,formatted:a(f,n.i18n)},txHash:{value:C,formatted:C?l(C):``},..._(n,w,C)?{txExplorerUrl:_(n,w,C)}:{},...T?{completionTx:{hash:{value:T,formatted:l(T)},...E?{explorerUrl:E}:{}}}:{}}}function p(t,n,r){let a=t.from,c=i(a?.confirmed_at)??i(t.created_at)??Date.now(),u=i(t.updated_at)??Date.now(),d=m(n,r),f=n.destination.address,p=a?.tx_id,h=a?.eip155_id===void 0?void 0:Number(a.eip155_id);return{kind:`failed`,failureKind:e(t.error),receiveAsset:d,receiveAmount:{value:0,formatted:s(0,r.i18n)},recipient:{value:f,formatted:l(f)},submittedAt:{value:c,formatted:o(c,r.i18n)},failedAt:{value:u,formatted:o(u,r.i18n)},...p?{txHash:{value:p,formatted:l(p)},..._(r,h,p)?{txExplorerUrl:_(r,h,p)}:{}}:{}}}function m(e,t){let n=t.receiveAssetEnrichment,r=Number(e.destination.eip155_id);return{symbol:e.destination.asset_symbol,decimals:e.destination.asset_decimals,address:e.destination.asset_address,isNative:!e.destination.asset_address,...n?.assetLogoUrl?{assetLogoUrl:n.assetLogoUrl}:{},networkId:e.destination.network_id,networkName:n?.networkName??e.destination.network_name,...Number.isFinite(r)?{eip155Id:e.destination.eip155_id}:{},...n?.chainLogoUrl?{chainLogoUrl:n.chainLogoUrl}:{}}}function h(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 g(e,t,n){return n.receiveAssetDecimals??e?.asset_decimals??t.destination.asset_decimals}function _(e,t,n){if(!n||t===void 0)return;let r=e.explorers?.[t];if(r)return`${r.replace(/\/+$/,``)}/tx/${n}`}function v(e){if(e==null||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}export{u as settlementToWithdrawalPayload};
@@ -1 +1 @@
1
- import{formatNetworkName as e}from"../../../../shared/format/formatNetworkName.js";function t(t,n={}){let r=n.excludedChainIds,i=[];for(let n of t.assets){if(r?.has(n.eip155_id))continue;let t=n.native_currency,a=new Set,o=(e,t)=>`${e.toUpperCase()}@${t.toLowerCase()}`,s=[];if(t?.symbol){let e={symbol:t.symbol,name:t.name??t.symbol,address:``,decimals:typeof t.decimals==`number`?t.decimals:18,isNative:!0,...t.logo?{assetLogoUrl:t.logo}:{}};s.push(e),a.add(o(e.symbol,e.address))}let c=t?.symbol?.toUpperCase();for(let e of n.assets){if(!e.symbol||!e.address||c&&e.symbol.toUpperCase()===c)continue;let t=o(e.symbol,e.address);a.has(t)||(a.add(t),s.push({symbol:e.symbol,name:e.name??e.symbol,address:e.address,decimals:e.decimals,isNative:!1,...e.logo?{assetLogoUrl:e.logo}:{}}))}s.length!==0&&i.push({networkId:n.network_id,networkName:e(n.network_name),eip155Id:n.eip155_id,...t?.logo?{chainLogoUrl:t.logo}:{},tokens:s})}return i.sort((e,t)=>e.eip155Id-t.eip155Id),i}export{t as supportedAssetsToReceiveOptionsPayload};
1
+ import{toChainType as e}from"../../../../shared/chains/index.js";import{formatNetworkName as t}from"../../../../shared/format/formatNetworkName.js";function n(n,r={}){let i=r.excludedChainIds,a=[];for(let r of n.assets){if(i?.has(r.eip155_id))continue;let n=r.native_currency,o=new Set,s=(e,t)=>`${e.toUpperCase()}@${t.toLowerCase()}`,c=[];if(n?.symbol){let e={symbol:n.symbol,name:n.name??n.symbol,address:``,decimals:typeof n.decimals==`number`?n.decimals:18,isNative:!0,...n.logo?{assetLogoUrl:n.logo}:{}};c.push(e),o.add(s(e.symbol,e.address))}let l=n?.symbol?.toUpperCase();for(let e of r.assets){if(!e.symbol||!e.address||l&&e.symbol.toUpperCase()===l)continue;let t=s(e.symbol,e.address);o.has(t)||(o.add(t),c.push({symbol:e.symbol,name:e.name??e.symbol,address:e.address,decimals:e.decimals,isNative:!1,...e.logo?{assetLogoUrl:e.logo}:{}}))}c.length!==0&&a.push({networkId:r.network_id,networkName:t(r.network_name),eip155Id:r.eip155_id,chainType:e(r.chain_type),...n?.logo?{chainLogoUrl:n.logo}:{},tokens:c})}return a.sort((e,t)=>e.eip155Id-t.eip155Id),a}export{n as supportedAssetsToReceiveOptionsPayload};
@@ -1,6 +1,9 @@
1
1
  import { Entity, SettlementFailureKind, TxRef } from "../../../shared/driver/types.js";
2
+ import { FormattedField } from "../../../shared/format/types.js";
3
+ import { ActivityHistoryPayload } from "../../../shared/widgets/activity-history/payloads.js";
2
4
  import { ReceiveOptionDto, ReceiveOptionsResponse, WithdrawableBalanceDto, WithdrawableBalancesResponse, WithdrawalQuoteDto, WithdrawalQuoteResponse, WithdrawalSettlementDto, WithdrawalSettlementResponse } from "./dto.js";
3
5
  import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItemPayload, WithdrawalQuoteBreakdownPayload, WithdrawalQuotePayload, WithdrawalReceiveAssetPayload, WithdrawalSettlementFailurePayload, WithdrawalSettlementPayload, WithdrawalSettlementPendingPayload, WithdrawalSettlementSuccessPayload } from "./payloads.js";
6
+ import { GatewayPollResponse, GatewayUdaDto } from "@stridge/sdk";
4
7
 
5
8
  //#region src/flows/withdraw/driver/types.d.ts
6
9
  /**
@@ -8,8 +11,9 @@ import { ReceiveChainPayload, ReceiveTokenOptionPayload, WithdrawableBalanceItem
8
11
  * {@link WithdrawDriver.getSnapshot} and consumed by `useSyncExternalStore`. The kit's
9
12
  * `useWithdrawSnapshot()` hook returns this shape.
10
13
  *
11
- * Each field is an {@link Entity} envelope — components switch on `status` and read `payload` on
12
- * the `ready` / `stale` variants.
14
+ * Most fields are {@link Entity} envelopes — components switch on `status` and read `payload` on
15
+ * the `ready` / `stale` variants. The optional `minAmountUsd` / `maxAmountUsd` carry static
16
+ * config-derived USD bounds (set once at driver construction) and stay outside the entity model.
13
17
  */
14
18
  interface WithdrawSnapshot {
15
19
  /**
@@ -23,7 +27,7 @@ interface WithdrawSnapshot {
23
27
  withdrawableBalances: Entity<ReadonlyArray<WithdrawableBalanceItemPayload>, WithdrawableBalancesResponse, WithdrawableBalancesResponse>;
24
28
  /**
25
29
  * Per-chain catalog of routable receive destinations. Drives the form's "Receive chain" /
26
- * "Receive token" pickers. Derived from `Uda.supportedAssets()`.
30
+ * "Receive token" pickers. Derived from `Gateway.assets()`.
27
31
  */
28
32
  receiveOptions: Entity<ReadonlyArray<ReceiveChainPayload>, ReadonlyArray<ReceiveOptionDto>, ReceiveOptionsResponse>;
29
33
  /**
@@ -37,6 +41,27 @@ interface WithdrawSnapshot {
37
41
  * error state screen renders.
38
42
  */
39
43
  settlement: Entity<WithdrawalSettlementPayload, WithdrawalSettlementDto, WithdrawalSettlementResponse>;
44
+ /**
45
+ * Optional lower USD bound on the withdraw amount. The withdraw form blocks submit with a
46
+ * localized "Min $X" CTA when the typed amount sits below `value`. Set from
47
+ * `<StridgeProvider flows.withdraw.minAmountUsd>` and constant across the driver's lifetime.
48
+ */
49
+ minAmountUsd?: FormattedField<number>;
50
+ /**
51
+ * Optional upper USD bound on the withdraw amount. The withdraw form blocks submit with a
52
+ * localized "Max $X" CTA when the typed amount sits above `value`. Set from
53
+ * `<StridgeProvider flows.withdraw.maxAmountUsd>` and constant across the driver's lifetime.
54
+ */
55
+ maxAmountUsd?: FormattedField<number>;
56
+ /**
57
+ * Owner-scoped recent activity. Backed by the same multi-UDA envelope from
58
+ * `GET /gateway/{owner}` the deposit flow consumes — the list spans both deposit-direction
59
+ * and withdraw-direction settlements for the connected owner. Drives the kit's in-dialog
60
+ * `<ActivityHistory>` surface. `idle` when no fetch has run yet; `loading` during the first
61
+ * fetch; `ready` / `stale` once a list has landed; `error` when the initial fetch failed and
62
+ * the list is empty.
63
+ */
64
+ history: Entity<ActivityHistoryPayload, ReadonlyArray<GatewayUdaDto>, GatewayPollResponse>;
40
65
  }
41
66
  /**
42
67
  * Input to {@link WithdrawDriver.requestQuote}. The form widget builds this from current field
@@ -57,17 +82,57 @@ interface RequestWithdrawalQuoteInput {
57
82
  recipientAddress: string;
58
83
  }
59
84
  /**
60
- * Input to {@link WithdrawDriver.submitWithdrawal}. Identical to {@link RequestWithdrawalQuoteInput}
61
- * — the live driver re-uses the most recent quote for submit, so the same identifying fields
62
- * scope both calls.
85
+ * Input to {@link WithdrawDriver.prepareWithdrawal}. Identical to {@link RequestWithdrawalQuoteInput}
86
+ * — the live driver re-uses the most recent quote shape for the gateway/start call, so the same
87
+ * identifying fields scope both calls.
63
88
  */
64
- type SubmitWithdrawalInput = RequestWithdrawalQuoteInput;
89
+ type PrepareWithdrawalInput = RequestWithdrawalQuoteInput;
90
+ /**
91
+ * Result of {@link WithdrawDriver.prepareWithdrawal}. Carries everything the host's `onSubmit`
92
+ * callback needs to broadcast a transfer to the Stridge UDA on the brand-currency chain — the
93
+ * UDA address, the chain, the token, the amount — plus the Stridge correlation fields the host
94
+ * may want to mirror into their own backend logs.
95
+ */
96
+ interface WithdrawPreparation {
97
+ /**
98
+ * Where the host should send brand-currency funds. The kit has already provisioned a UDA
99
+ * (via `gateway/start`); the host's job is to broadcast a single on-chain transfer of
100
+ * `amount` of `tokenSymbol` from their treasury / custodial wallet to `address` on `chainId`.
101
+ * Stridge takes over from there to bridge into the user's chosen recipient/chain/token.
102
+ */
103
+ depositTarget: {
104
+ /** UDA deposit address on the brand-currency chain. */address: string; /** EIP-155 chain id of the brand-currency network. */
105
+ chainId: number; /** Brand-currency token symbol (e.g. `"USDC"`). */
106
+ tokenSymbol: string; /** ERC-20 contract address of the brand currency. Empty string for native gas tokens. */
107
+ tokenAddress: string; /** On-chain decimal precision (e.g. `6` for USDC on Ethereum, `18` for ETH). */
108
+ tokenDecimals: number; /** `true` when the brand currency is the chain's native gas token. */
109
+ isNative: boolean; /** Exact amount to transfer, in display units (kit-managed decimals already factored in). */
110
+ amount: number;
111
+ };
112
+ /**
113
+ * Stridge correlation slot the host can pass through to their own backend / logs. `owner`
114
+ * is the same value the kit threaded into `gateway/start.owner` for this UDA.
115
+ */
116
+ correlation: {
117
+ owner: string;
118
+ };
119
+ }
65
120
  /**
66
- * Input to {@link WithdrawDriver.watchSettlement}. Carries the broadcast tx ref so the watcher
67
- * can scope its poll to the in-flight withdraw.
121
+ * Input to {@link WithdrawDriver.watchSettlement}. `tx` is optional when the host has
122
+ * surfaced a broadcast tx hash via the orchestrator's `setTxHash` action, the watcher anchors
123
+ * to it for precise matching. When omitted, the watcher falls back to a best-match heuristic
124
+ * (destination tuple + amount tolerance + submit-time window) so the kit can find the relevant
125
+ * settlement even if the host never surfaces a tx hash.
68
126
  */
69
127
  interface WatchWithdrawalSettlementInput {
70
- tx: TxRef;
128
+ tx?: TxRef;
129
+ /**
130
+ * Form snapshot at submit time. The driver uses this in best-match mode to filter
131
+ * `gateway/{owner}` to settlements whose destination matches the user's selection.
132
+ */
133
+ form: RequestWithdrawalQuoteInput;
134
+ /** Unix-ms timestamp the host called `beginProcessing` — the start of the matching window. */
135
+ submittedAt: number;
71
136
  }
72
137
  /**
73
138
  * Input to {@link WithdrawDriver.watchWithdrawableBalances}. Optional listener — the form's
@@ -107,16 +172,25 @@ interface WithdrawDriver {
107
172
  getSnapshot(): WithdrawSnapshot;
108
173
  /** Subscribe to entity transitions outside React (analytics, headless integrations). */
109
174
  subscribe(listener: () => void): () => void;
175
+ /**
176
+ * Idempotent bootstrap trigger. The kit calls this from `useWithdraw().open()` and the
177
+ * headless `usePrefetchWithdraw()` hook. First call kicks off any deferred network work
178
+ * (e.g. `supportedAssets` + the initial `balance/onchain` fetch); subsequent calls are
179
+ * no-ops while bootstrap is in flight or completed.
180
+ */
181
+ arm(): void;
110
182
  /**
111
183
  * Fetches a fresh quote for `input` and updates the `quote` entity through its lifecycle
112
184
  * (`idle | loading → ready | error`). The `signal` cancels in-flight work.
113
185
  */
114
186
  requestQuote(input: RequestWithdrawalQuoteInput, signal: AbortSignal): Promise<void>;
115
187
  /**
116
- * Submits the confirmed withdrawal. Resolves with the broadcast tx ref. The settlement
117
- * watcher takes over from there to populate the `settlement` entity.
188
+ * Provisions a fresh UDA for this withdrawal (via `gateway/start`) and returns the deposit
189
+ * target + Stridge correlation slot for the host's `onSubmit` callback to act on. The kit
190
+ * never signs the withdraw transfer itself — the host's backend (treasury wallet, custodial
191
+ * signer, hot-wallet service) does. See {@link WithdrawPreparation}.
118
192
  */
119
- submitWithdrawal(input: SubmitWithdrawalInput, signal: AbortSignal): Promise<TxRef>;
193
+ prepareWithdrawal(input: PrepareWithdrawalInput, signal: AbortSignal): Promise<WithdrawPreparation>;
120
194
  /**
121
195
  * Watches the settlement entity through its lifecycle (pending → succeeded / failed). The
122
196
  * listener fires on every transition with the new envelope; the FSM consumes these via the
@@ -128,6 +202,29 @@ interface WithdrawDriver {
128
202
  * into its own snapshot. Hosts that surface a static brand-side balance can omit this.
129
203
  */
130
204
  watchWithdrawableBalances?(input: WatchWithdrawableBalancesInput, listener: (entity: WithdrawSnapshot["withdrawableBalances"]) => void, signal: AbortSignal): void;
205
+ /**
206
+ * Owner-scoped activity refresh. Calls `GET /gateway/{owner}` without a destination tuple,
207
+ * collapses the multi-UDA envelope into a row payload, and updates {@link
208
+ * WithdrawSnapshot.history} in place. Mirrors the deposit driver's contract — the kit's
209
+ * `<ActivityHistory>` surface is shared between the two dialogs, so both drivers expose the
210
+ * same refresh action. Used as the imperative one-shot trigger — the activity surface's
211
+ * error-view retry button calls this. Steady-state recurring fetches land via
212
+ * {@link watchHistory}. Optional — drivers that don't have a multi-UDA history concept can
213
+ * omit it, in which case the activity header icon is hidden.
214
+ */
215
+ refreshHistory?(signal: AbortSignal): void;
216
+ /**
217
+ * Long-running adaptive poll of `GET /gateway/{owner}` (unfiltered). Updates
218
+ * {@link WithdrawSnapshot.history} in place every tick. Cadence adapts to the
219
+ * current payload — short interval while any row is `pending`, long interval
220
+ * once all rows are terminal. Mounted by the controller while the FSM is on
221
+ * `history`; aborted on transition out.
222
+ *
223
+ * Optional — drivers that don't have a multi-UDA history concept can omit
224
+ * it. When omitted alongside {@link refreshHistory}, the activity surface
225
+ * stays cold (only the initial paint, no live updates).
226
+ */
227
+ watchHistory?(signal: AbortSignal): void;
131
228
  }
132
229
  //#endregion
133
- export { RequestWithdrawalQuoteInput, SubmitWithdrawalInput, WatchWithdrawableBalancesInput, WatchWithdrawalSettlementInput, WithdrawDriver, WithdrawSnapshot };
230
+ export { PrepareWithdrawalInput, RequestWithdrawalQuoteInput, WatchWithdrawableBalancesInput, WatchWithdrawalSettlementInput, WithdrawDriver, WithdrawPreparation, WithdrawSnapshot };
@@ -1 +1 @@
1
- "use client";import{useLingui as e}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as t}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as n}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as r}from"../../../shared/orchestrator/useEffectiveState.js";import{useSettlementWatcher as i}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useWithdrawDriverInstance as a}from"../driver/context.js";import{initialState as o,reducer as s}from"./reducer.js";import{createContext as c,use as l,useCallback as u,useMemo as d,useReducer as f,useRef as p}from"react";import{jsx as m}from"react/jsx-runtime";const h={id:`ldK3jJ`,message:`Failed to submit withdrawal.`},g={id:`kUFhUv`,message:`Withdrawal failed.`},_=c(null);_.displayName=`WithdrawControllerContext`;function v(){let e=l(_);if(!e)throw Error(`useWithdraw / WithdrawControllerProvider must be used inside <KitProvider withdraw={…} />. Mount KitProvider once at the host's app root with a withdraw driver.`);return e}function y(){return v().state}function b(){return v().effectiveState}function x(){return v().actions}function S({children:e}){let t=a(),[n,c]=f(s,o),l=w(n,c,t);i(t,n.name===`inProgress`?n.ctx.tx:void 0),T(n,c,t);let u=r(n),p=C(c,l);return m(_,{value:d(()=>({state:n,effectiveState:u,dispatch:c,controller:p,actions:l}),[n,u,p,l]),children:e})}function C(e,t){let n=u(()=>{e({type:`OPEN`})},[e]),r=u(()=>{e({type:`CLOSE`})},[e]);return d(()=>({open:n,close:r,actions:t}),[n,r,t])}function w(n,r,i){let a=p(n);a.current=n;let o=p(i);o.current=i;let s=p(r);s.current=r;let{i18n:c}=e(),l=p(c);l.current=c;let f=u(e=>{let n=o.current;s.current({type:`SUBMIT`,input:e});let r=new AbortController,i={sourceAssetSymbol:e.sourceAssetSymbol,sourceChainId:e.sourceChainId,amount:e.amount,receiveTokenSymbol:e.receiveTokenSymbol,receiveChainId:e.receiveChainId,recipientAddress:e.recipientAddress};n.submitWithdrawal(i,r.signal).then(e=>{r.signal.aborted||s.current({type:`SUBMIT_CONFIRMED`,tx:e})}).catch(n=>{r.signal.aborted||s.current({type:`SUBMIT_FAILED`,failure:t(n,l.current._(h)),input:e})})},[]),m=u(()=>{s.current({type:`CLOSE`})},[]),g=u(()=>{s.current({type:`RESET`})},[]),_=u(()=>{s.current({type:`CLEAR_NOTICE`})},[]);return d(()=>({submit:f,close:m,reset:g,clearNotice:_}),[f,m,g,_])}function T(t,r,i){let a=p(t);a.current=t;let{i18n:o}=e(),s=p(o);s.current=o,n(i,(e,t)=>{if(a.current.name===`inProgress`){if(e===`succeeded`){r({type:`SETTLEMENT_SUCCEEDED`});return}if(e===`failed`){let e=t.settlement,n=e.status===`ready`||e.status===`stale`?e.payload:null,i=n&&n.kind===`failed`?{reason:s.current._(g),code:n.failureKind}:void 0;r({type:`SETTLEMENT_FAILED`,...i?{failure:i}:{}})}}})}export{S as WithdrawControllerProvider,v as useControllerContext,x as useWithdrawActions,b as useWithdrawEffectiveState,y as useWithdrawState};
1
+ "use client";import{useLingui as e}from"../../../shared/i18n/useLingui.js";import"../../../i18n/index.js";import{toFailure as t}from"../../../shared/orchestrator/toFailure.js";import{useDriverSettlementListener as n}from"../../../shared/orchestrator/useDriverSettlementListener.js";import{useEffectiveState as r}from"../../../shared/orchestrator/useEffectiveState.js";import{useSettlementWatcher as i}from"../../../shared/orchestrator/useSettlementWatcher.js";import"../../../shared/orchestrator/index.js";import{useWithdrawBindingsRef as a}from"../bindings/WithdrawBindings.js";import"../bindings/index.js";import{useWithdrawDriverInstance as o}from"../driver/context.js";import{initialState as s,reducer as c}from"./reducer.js";import{createContext as l,use as u,useCallback as d,useEffect as f,useMemo as p,useReducer as m,useRef as h}from"react";import{jsx as g}from"react/jsx-runtime";const _={id:`ldK3jJ`,message:`Failed to submit withdrawal.`},v={id:`kUFhUv`,message:`Withdrawal failed.`},y={id:`srsA0x`,message:`Withdrawal declined.`},b=l(null);b.displayName=`WithdrawControllerContext`;function x(){let e=u(b);if(!e)throw Error(`useWithdraw / WithdrawControllerProvider must be used inside <KitProvider withdraw={…} />. Mount KitProvider once at the host's app root with a withdraw driver.`);return e}function S(){return u(b)}function C(){return x().state}function w(){return x().effectiveState}function T(){return x().actions}function E({children:e}){let t=o(),[n,a]=m(c,s),l=O(n,a,t),u=n.name===`inProgress`?{form:n.ctx.input,submittedAt:n.ctx.submittedAt,...n.ctx.tx?{tx:n.ctx.tx}:{}}:void 0;i(t,u,u?`${u.submittedAt}|${u.tx?.hash??``}`:void 0),k(t,n.name===`historyList`||n.name===`historyDetail`),A(n,a,t);let d=r(n),f=D(a,l,t);return g(b,{value:p(()=>({state:n,effectiveState:d,dispatch:a,controller:f,actions:l}),[n,d,f,l]),children:e})}function D(e,t,n){let r=h(n);r.current=n;let i=d(()=>{r.current.arm(),e({type:`OPEN`})},[e]),a=d(()=>{e({type:`CLOSE`})},[e]);return p(()=>({open:i,close:a,actions:t}),[i,a,t])}function O(n,r,i){let o=h(n);o.current=n;let s=h(i);s.current=i;let c=h(r);c.current=r;let{i18n:l}=e(),u=h(l);u.current=l;let f=a(),m=d(e=>{let n=s.current;c.current({type:`SUBMIT`,input:e});let r=new AbortController,i={sourceAssetSymbol:e.sourceAssetSymbol,sourceChainId:e.sourceChainId,amount:e.amount,receiveTokenSymbol:e.receiveTokenSymbol,receiveChainId:e.receiveChainId,recipientAddress:e.recipientAddress},a={beginProcessing(e){c.current({type:`BEGIN_PROCESSING`,submittedAt:Date.now(),...e?{tx:e}:{}})},setTxHash(e){c.current({type:`SET_TX_HASH`,tx:e,submittedAt:Date.now()})},fail(e){c.current({type:`MARK_FAILED`,...e?{failure:e}:{}})},decline(){c.current({type:`SUBMIT_FAILED`,failure:{reason:u.current._(y),code:`UserRejectedRequestError`},input:e})},succeed(){c.current({type:`MARK_SUCCEEDED`})}};n.prepareWithdrawal(i,r.signal).then(i=>{if(r.signal.aborted)return;let o=f.current.onSubmit;if(!o){c.current({type:`SUBMIT_FAILED`,failure:t(Error(`WithdrawDialog onSubmit is missing.`),u.current._(_)),input:e});return}let s=n.getSnapshot().quote,l=s.status===`ready`||s.status===`stale`?s.payload:void 0;try{let n=o({form:e,depositTarget:i.depositTarget,correlation:i.correlation,...l?{quote:l}:{}},a,r.signal);n&&typeof n.catch==`function`&&n.catch(n=>{r.signal.aborted||c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(_)),input:e})})}catch(n){if(r.signal.aborted)return;c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(_)),input:e})}}).catch(n=>{r.signal.aborted||c.current({type:`SUBMIT_FAILED`,failure:t(n,u.current._(_)),input:e})})},[]),g=d(()=>{c.current({type:`CLOSE`})},[]),v=d(()=>{c.current({type:`RESET`})},[]),b=d(()=>{c.current({type:`CLEAR_NOTICE`})},[]),x=d(()=>{c.current({type:`BACK`})},[]),S=d(()=>{o.current.name===`form`&&c.current({type:`OPEN_HISTORY`})},[]),C=d(e=>{c.current({type:`SELECT_SETTLEMENT`,settlementId:e})},[]);return p(()=>({submit:m,close:g,reset:v,clearNotice:b,back:x,openHistory:S,selectSettlement:C}),[m,g,v,b,x,S,C])}function k(e,t){f(()=>{if(!t||!e.watchHistory)return;let n=new AbortController;return e.watchHistory(n.signal),()=>n.abort()},[t,e])}function A(t,r,i){let a=h(t);a.current=t;let{i18n:o}=e(),s=h(o);s.current=o,n(i,(e,t)=>{if(a.current.name===`inProgress`){if(e===`succeeded`){r({type:`SETTLEMENT_SUCCEEDED`});return}if(e===`failed`){let e=t.settlement,n=e.status===`ready`||e.status===`stale`?e.payload:null,i=n&&n.kind===`failed`?{reason:s.current._(v),code:n.failureKind}:void 0;r({type:`SETTLEMENT_FAILED`,...i?{failure:i}:{}})}}})}export{E as WithdrawControllerProvider,x as useControllerContext,S as useOptionalControllerContext,T as useWithdrawActions,w as useWithdrawEffectiveState,C as useWithdrawState};
@@ -1,4 +1,4 @@
1
1
  import { FailureInfo } from "../../../shared/orchestrator/types.js";
2
2
  import { WithdrawActions, WithdrawController, WithdrawEvent, WithdrawState, WithdrawStateName, WithdrawalFormSnapshot } from "./types.js";
3
3
  import { useWithdrawState } from "./controller.js";
4
- import { useWithdraw } from "./useWithdraw.js";
4
+ import { useOptionalWithdraw, usePrefetchWithdraw, useWithdraw } from "./useWithdraw.js";
@@ -1 +1 @@
1
- import{isUserRejectionFailure as e}from"../../../shared/orchestrator/userRejection.js";import"../../../shared/orchestrator/index.js";const t={name:`closed`};function n(e,t){switch(e.name){case`closed`:return r(t);case`form`:return i(e,t);case`submitting`:return a(e,t);case`inProgress`:return o(e,t);case`success`:return s(e,t);case`error`:return c(e,t);default:return l(e)}}function r(e){return e.type===`OPEN`?{name:`form`}:{name:`closed`}}function i(e,t){switch(t.type){case`SUBMIT`:return{name:`submitting`,ctx:{input:t.input}};case`CLEAR_NOTICE`:return e.ctx?.notice?{name:`form`}:e;case`CLOSE`:return{name:`closed`};default:return e}}function a(t,n){switch(n.type){case`SUBMIT_CONFIRMED`:return{name:`inProgress`,ctx:{input:t.ctx.input,tx:n.tx}};case`SUBMIT_FAILED`:return e(n.failure)?{name:`form`,ctx:{notice:n.failure.reason}}:{name:`error`,ctx:{input:n.input,failure:n.failure}};case`CLOSE`:return{name:`closed`};default:return t}}function o(e,t){switch(t.type){case`SETTLEMENT_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input,tx:e.ctx.tx}};case`SETTLEMENT_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,tx:e.ctx.tx,...t.failure?{failure:t.failure}:{}}};case`CLOSE`:return{name:`closed`};default:return e}}function s(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e){throw Error(`Unhandled withdraw state: ${JSON.stringify(e)}`)}export{t as initialState,n as reducer};
1
+ import{isUserRejectionFailure as e}from"../../../shared/orchestrator/userRejection.js";import"../../../shared/orchestrator/index.js";const t={name:`closed`};function n(e,t){switch(e.name){case`closed`:return r(t);case`form`:return i(e,t);case`submitting`:return a(e,t);case`inProgress`:return o(e,t);case`success`:return s(e,t);case`error`:return c(e,t);case`historyList`:return l(e,t);case`historyDetail`:return u(e,t);default:return f(e)}}function r(e){return e.type===`OPEN`?{name:`form`}:{name:`closed`}}function i(e,t){switch(t.type){case`SUBMIT`:return{name:`submitting`,ctx:{input:t.input}};case`CLEAR_NOTICE`:return e.ctx?.notice?{name:`form`}:e;case`OPEN_HISTORY`:return{name:`historyList`,ctx:{backTarget:{kind:`form`,...e.ctx?.notice?{notice:e.ctx.notice}:{}}}};case`CLOSE`:return{name:`closed`};default:return e}}function a(t,n){switch(n.type){case`BEGIN_PROCESSING`:return{name:`inProgress`,ctx:{input:t.ctx.input,submittedAt:n.submittedAt,...n.tx?{tx:n.tx}:{}}};case`SET_TX_HASH`:return{name:`inProgress`,ctx:{input:t.ctx.input,submittedAt:n.submittedAt,tx:n.tx}};case`MARK_SUCCEEDED`:return{name:`success`,ctx:{input:t.ctx.input}};case`MARK_FAILED`:return{name:`error`,ctx:{input:t.ctx.input,...n.failure?{failure:n.failure}:{}}};case`SUBMIT_FAILED`:return e(n.failure)?{name:`form`,ctx:{notice:n.failure.reason}}:{name:`error`,ctx:{input:n.input,failure:n.failure}};case`CLOSE`:return{name:`closed`};default:return t}}function o(e,t){switch(t.type){case`SET_TX_HASH`:return{name:`inProgress`,ctx:{...e.ctx,tx:t.tx}};case`BEGIN_PROCESSING`:return{name:`inProgress`,ctx:{input:e.ctx.input,submittedAt:e.ctx.submittedAt,...e.ctx.tx?{tx:e.ctx.tx}:t.tx?{tx:t.tx}:{}}};case`MARK_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{}}};case`MARK_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{},...t.failure?{failure:t.failure}:{}}};case`SETTLEMENT_SUCCEEDED`:return{name:`success`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{}}};case`SETTLEMENT_FAILED`:return{name:`error`,ctx:{input:e.ctx.input,...e.ctx.tx?{tx:e.ctx.tx}:{},...t.failure?{failure:t.failure}:{}}};case`CLOSE`:return{name:`closed`};default:return e}}function s(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function c(e,t){switch(t.type){case`RESET`:return{name:`form`};case`CLOSE`:return{name:`closed`};default:return e}}function l(e,t){switch(t.type){case`SELECT_SETTLEMENT`:return{name:`historyDetail`,ctx:{settlementId:t.settlementId,backTarget:e.ctx.backTarget}};case`BACK`:return d(e.ctx.backTarget);case`CLOSE`:return{name:`closed`};default:return e}}function u(e,t){switch(t.type){case`BACK`:return{name:`historyList`,ctx:{backTarget:e.ctx.backTarget}};case`CLOSE`:return{name:`closed`};default:return e}}function d(e){return e.kind===`form`?e.notice?{name:`form`,ctx:{notice:e.notice}}:{name:`form`}:f(e.kind)}function f(e){throw Error(`Unhandled withdraw state: ${JSON.stringify(e)}`)}export{t as initialState,n as reducer};