@mintmoney/react 0.2.0-alpha.2 → 0.2.0-alpha.3

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 (300) hide show
  1. package/dist/css/styles.css +12 -1
  2. package/dist/esm/api/errors.js +89 -0
  3. package/dist/esm/api/errors.js.map +1 -0
  4. package/dist/esm/api/generated.js +825 -65
  5. package/dist/esm/api/generated.js.map +1 -1
  6. package/dist/esm/api/payments.js +26 -2
  7. package/dist/esm/api/payments.js.map +1 -1
  8. package/dist/esm/api/tokens.js +34 -0
  9. package/dist/esm/api/tokens.js.map +1 -0
  10. package/dist/esm/api/types.js.map +1 -1
  11. package/dist/esm/checkout/claimable-funds.js +20 -10
  12. package/dist/esm/checkout/claimable-funds.js.map +1 -1
  13. package/dist/esm/checkout/creation-error-modal.js +2 -2
  14. package/dist/esm/checkout/creation-error-modal.js.map +1 -1
  15. package/dist/esm/checkout/index.js +48 -8
  16. package/dist/esm/checkout/index.js.map +1 -1
  17. package/dist/esm/checkout/modal.js +22 -14
  18. package/dist/esm/checkout/modal.js.map +1 -1
  19. package/dist/esm/checkout/payment-status.js +68 -28
  20. package/dist/esm/checkout/payment-status.js.map +1 -1
  21. package/dist/esm/checkout/provider-status.js +9 -0
  22. package/dist/esm/checkout/provider-status.js.map +1 -0
  23. package/dist/esm/checkout/providers/checkout-wallet.js +140 -44
  24. package/dist/esm/checkout/providers/checkout-wallet.js.map +1 -1
  25. package/dist/esm/checkout/providers/wagmi-config.js +6 -3
  26. package/dist/esm/checkout/providers/wagmi-config.js.map +1 -1
  27. package/dist/esm/checkout/refund-notice.js +16 -0
  28. package/dist/esm/checkout/refund-notice.js.map +1 -0
  29. package/dist/esm/checkout/resume-state.js +147 -0
  30. package/dist/esm/checkout/resume-state.js.map +1 -1
  31. package/dist/esm/checkout/surplus-refund.js +12 -0
  32. package/dist/esm/checkout/surplus-refund.js.map +1 -1
  33. package/dist/esm/checkout/views/amount-header.js +1 -1
  34. package/dist/esm/checkout/views/amount-header.js.map +1 -1
  35. package/dist/esm/checkout/views/claimable-funds.js +22 -13
  36. package/dist/esm/checkout/views/claimable-funds.js.map +1 -1
  37. package/dist/esm/checkout/views/crypto-intent/direct-details.js +218 -890
  38. package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
  39. package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js +235 -0
  40. package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js.map +1 -0
  41. package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js +2 -26
  42. package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js.map +1 -1
  43. package/dist/esm/checkout/views/crypto-intent/manual-refresh.js +19 -0
  44. package/dist/esm/checkout/views/crypto-intent/manual-refresh.js.map +1 -0
  45. package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js +151 -23
  46. package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js.map +1 -1
  47. package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js +295 -0
  48. package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js.map +1 -0
  49. package/dist/esm/checkout/views/crypto-intent/manual-sources.js +155 -0
  50. package/dist/esm/checkout/views/crypto-intent/manual-sources.js.map +1 -0
  51. package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js +84 -0
  52. package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js.map +1 -0
  53. package/dist/esm/checkout/views/crypto-intent/payment-route-error.js +10 -0
  54. package/dist/esm/checkout/views/crypto-intent/payment-route-error.js.map +1 -0
  55. package/dist/esm/checkout/views/crypto-intent/processing.js +167 -24
  56. package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
  57. package/dist/esm/checkout/views/crypto-intent/success.js +74 -46
  58. package/dist/esm/checkout/views/crypto-intent/success.js.map +1 -1
  59. package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js +14 -24
  60. package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js.map +1 -1
  61. package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js +61 -0
  62. package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js.map +1 -0
  63. package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js +105 -627
  64. package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js.map +1 -1
  65. package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js +506 -0
  66. package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js.map +1 -0
  67. package/dist/esm/checkout/views/crypto-intent/wallet-select.js +4 -11
  68. package/dist/esm/checkout/views/crypto-intent/wallet-select.js.map +1 -1
  69. package/dist/esm/checkout/views/failed.js +62 -26
  70. package/dist/esm/checkout/views/failed.js.map +1 -1
  71. package/dist/esm/checkout/views/funding-timeline.js +255 -0
  72. package/dist/esm/checkout/views/funding-timeline.js.map +1 -0
  73. package/dist/esm/checkout/views/initial.js +25 -44
  74. package/dist/esm/checkout/views/initial.js.map +1 -1
  75. package/dist/esm/checkout/views/method-select.js +6 -4
  76. package/dist/esm/checkout/views/method-select.js.map +1 -1
  77. package/dist/esm/checkout/views/payment-follower.js +105 -0
  78. package/dist/esm/checkout/views/payment-follower.js.map +1 -0
  79. package/dist/esm/checkout/views/restart.js +8 -2
  80. package/dist/esm/checkout/views/restart.js.map +1 -1
  81. package/dist/esm/components/buttons/index.js +3 -2
  82. package/dist/esm/components/buttons/index.js.map +1 -1
  83. package/dist/esm/components/icons/search.js +5 -0
  84. package/dist/esm/components/icons/search.js.map +1 -0
  85. package/dist/esm/components/loading/index.js +2 -2
  86. package/dist/esm/components/loading/index.js.map +1 -1
  87. package/dist/esm/components/modals/modal-with-views.js +6 -12
  88. package/dist/esm/components/modals/modal-with-views.js.map +1 -1
  89. package/dist/esm/components/modals/modal.js +3 -3
  90. package/dist/esm/components/modals/modal.js.map +1 -1
  91. package/dist/esm/components/modals/transition-view.js +16 -0
  92. package/dist/esm/components/modals/transition-view.js.map +1 -0
  93. package/dist/esm/components/modals/use-modal-with-views.js +17 -19
  94. package/dist/esm/components/modals/use-modal-with-views.js.map +1 -1
  95. package/dist/esm/components/wallet-selector/wallets/wagmi/index.js +21 -2
  96. package/dist/esm/components/wallet-selector/wallets/wagmi/index.js.map +1 -1
  97. package/dist/esm/config.js.map +1 -1
  98. package/dist/esm/integrations/bitcoin-metamask.js +87 -0
  99. package/dist/esm/integrations/bitcoin-metamask.js.map +1 -0
  100. package/dist/esm/integrations/bitcoin-network.js +59 -0
  101. package/dist/esm/integrations/bitcoin-network.js.map +1 -0
  102. package/dist/esm/integrations/bitcoin-psbt.js +4 -0
  103. package/dist/esm/integrations/bitcoin-psbt.js.map +1 -0
  104. package/dist/esm/integrations/bitcoin-source.js +12 -0
  105. package/dist/esm/integrations/bitcoin-source.js.map +1 -0
  106. package/dist/esm/integrations/bitcoin-wallet.js +225 -0
  107. package/dist/esm/integrations/bitcoin-wallet.js.map +1 -0
  108. package/dist/esm/integrations/evm-chain.js +18 -0
  109. package/dist/esm/integrations/evm-chain.js.map +1 -1
  110. package/dist/esm/integrations/guarded-wallet-client.js +19 -0
  111. package/dist/esm/integrations/guarded-wallet-client.js.map +1 -0
  112. package/dist/esm/integrations/lifi.js +85 -38
  113. package/dist/esm/integrations/lifi.js.map +1 -1
  114. package/dist/esm/refund/index.js +216 -225
  115. package/dist/esm/refund/index.js.map +1 -1
  116. package/dist/esm/state/checkout/bitcoin-payment.js +253 -0
  117. package/dist/esm/state/checkout/bitcoin-payment.js.map +1 -0
  118. package/dist/esm/state/checkout/checkout-state.js +3 -9
  119. package/dist/esm/state/checkout/checkout-state.js.map +1 -1
  120. package/dist/esm/state/checkout/funding.js +5 -0
  121. package/dist/esm/state/checkout/funding.js.map +1 -0
  122. package/dist/esm/state/checkout/issuance-conflicts.js +29 -0
  123. package/dist/esm/state/checkout/issuance-conflicts.js.map +1 -0
  124. package/dist/esm/state/checkout/manual-route.js +10 -0
  125. package/dist/esm/state/checkout/manual-route.js.map +1 -0
  126. package/dist/esm/state/checkout/payment-attempt.js +44 -20
  127. package/dist/esm/state/checkout/payment-attempt.js.map +1 -1
  128. package/dist/esm/state/checkout/payment-lifecycle.js +9 -15
  129. package/dist/esm/state/checkout/payment-lifecycle.js.map +1 -1
  130. package/dist/esm/state/checkout/payment-observer.js +147 -0
  131. package/dist/esm/state/checkout/payment-observer.js.map +1 -0
  132. package/dist/esm/state/checkout/payment-phase.js +131 -0
  133. package/dist/esm/state/checkout/payment-phase.js.map +1 -0
  134. package/dist/esm/state/checkout/quote-countdown.js +26 -0
  135. package/dist/esm/state/checkout/quote-countdown.js.map +1 -0
  136. package/dist/esm/state/checkout/quote-lifecycle.js +145 -144
  137. package/dist/esm/state/checkout/quote-lifecycle.js.map +1 -1
  138. package/dist/esm/state/checkout/route-estimate.js +77 -0
  139. package/dist/esm/state/checkout/route-estimate.js.map +1 -0
  140. package/dist/esm/state/checkout/store.js +222 -258
  141. package/dist/esm/state/checkout/store.js.map +1 -1
  142. package/dist/esm/state/checkout/wallet-payment.js +123 -32
  143. package/dist/esm/state/checkout/wallet-payment.js.map +1 -1
  144. package/dist/esm/utils/string.js +2 -0
  145. package/dist/esm/utils/string.js.map +1 -1
  146. package/dist/esm/utils/token-amount.js +88 -0
  147. package/dist/esm/utils/token-amount.js.map +1 -0
  148. package/dist/esm/utils/wallet-errors.js +21 -4
  149. package/dist/esm/utils/wallet-errors.js.map +1 -1
  150. package/dist/types/api/errors.d.ts +37 -0
  151. package/dist/types/api/errors.d.ts.map +1 -0
  152. package/dist/types/api/generated.d.ts +4562 -707
  153. package/dist/types/api/generated.d.ts.map +1 -1
  154. package/dist/types/api/payments.d.ts +28 -1
  155. package/dist/types/api/payments.d.ts.map +1 -1
  156. package/dist/types/api/tokens.d.ts +6 -0
  157. package/dist/types/api/tokens.d.ts.map +1 -0
  158. package/dist/types/api/types.d.ts +28 -2
  159. package/dist/types/api/types.d.ts.map +1 -1
  160. package/dist/types/checkout/claimable-funds.d.ts +15 -2
  161. package/dist/types/checkout/claimable-funds.d.ts.map +1 -1
  162. package/dist/types/checkout/creation-error-modal.d.ts +2 -1
  163. package/dist/types/checkout/creation-error-modal.d.ts.map +1 -1
  164. package/dist/types/checkout/index.d.ts +21 -1
  165. package/dist/types/checkout/index.d.ts.map +1 -1
  166. package/dist/types/checkout/modal.d.ts +4 -1
  167. package/dist/types/checkout/modal.d.ts.map +1 -1
  168. package/dist/types/checkout/payment-status.d.ts +10 -2
  169. package/dist/types/checkout/payment-status.d.ts.map +1 -1
  170. package/dist/types/checkout/provider-status.d.ts +11 -0
  171. package/dist/types/checkout/provider-status.d.ts.map +1 -0
  172. package/dist/types/checkout/providers/checkout-wallet.d.ts +2 -3
  173. package/dist/types/checkout/providers/checkout-wallet.d.ts.map +1 -1
  174. package/dist/types/checkout/providers/wagmi-config.d.ts.map +1 -1
  175. package/dist/types/checkout/refund-notice.d.ts +7 -0
  176. package/dist/types/checkout/refund-notice.d.ts.map +1 -0
  177. package/dist/types/checkout/resume-state.d.ts +41 -0
  178. package/dist/types/checkout/resume-state.d.ts.map +1 -1
  179. package/dist/types/checkout/surplus-refund.d.ts +8 -0
  180. package/dist/types/checkout/surplus-refund.d.ts.map +1 -1
  181. package/dist/types/checkout/views/amount-header.d.ts.map +1 -1
  182. package/dist/types/checkout/views/claimable-funds.d.ts.map +1 -1
  183. package/dist/types/checkout/views/crypto-intent/direct-details.d.ts +3 -13
  184. package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
  185. package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts +10 -0
  186. package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts.map +1 -0
  187. package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts +4 -11
  188. package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts.map +1 -1
  189. package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts +4 -0
  190. package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts.map +1 -0
  191. package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts +14 -10
  192. package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts.map +1 -1
  193. package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts +18 -0
  194. package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts.map +1 -0
  195. package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts +33 -0
  196. package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts.map +1 -0
  197. package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts +18 -0
  198. package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts.map +1 -0
  199. package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts +2 -0
  200. package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts.map +1 -0
  201. package/dist/types/checkout/views/crypto-intent/processing.d.ts.map +1 -1
  202. package/dist/types/checkout/views/crypto-intent/success.d.ts +2 -1
  203. package/dist/types/checkout/views/crypto-intent/success.d.ts.map +1 -1
  204. package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts +8 -8
  205. package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts.map +1 -1
  206. package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts +17 -0
  207. package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts.map +1 -0
  208. package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts +2 -1
  209. package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts.map +1 -1
  210. package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts +61 -0
  211. package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts.map +1 -0
  212. package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts +1 -2
  213. package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts.map +1 -1
  214. package/dist/types/checkout/views/failed.d.ts +6 -0
  215. package/dist/types/checkout/views/failed.d.ts.map +1 -1
  216. package/dist/types/checkout/views/funding-timeline.d.ts +49 -0
  217. package/dist/types/checkout/views/funding-timeline.d.ts.map +1 -0
  218. package/dist/types/checkout/views/initial.d.ts +2 -4
  219. package/dist/types/checkout/views/initial.d.ts.map +1 -1
  220. package/dist/types/checkout/views/method-select.d.ts +2 -1
  221. package/dist/types/checkout/views/method-select.d.ts.map +1 -1
  222. package/dist/types/checkout/views/payment-follower.d.ts +31 -0
  223. package/dist/types/checkout/views/payment-follower.d.ts.map +1 -0
  224. package/dist/types/checkout/views/restart.d.ts +1 -1
  225. package/dist/types/checkout/views/restart.d.ts.map +1 -1
  226. package/dist/types/components/buttons/index.d.ts.map +1 -1
  227. package/dist/types/components/icons/search.d.ts +2 -0
  228. package/dist/types/components/icons/search.d.ts.map +1 -0
  229. package/dist/types/components/loading/index.d.ts +6 -1
  230. package/dist/types/components/loading/index.d.ts.map +1 -1
  231. package/dist/types/components/modals/modal-with-views.d.ts +2 -0
  232. package/dist/types/components/modals/modal-with-views.d.ts.map +1 -1
  233. package/dist/types/components/modals/modal.d.ts +2 -1
  234. package/dist/types/components/modals/modal.d.ts.map +1 -1
  235. package/dist/types/components/modals/transition-view.d.ts +2 -0
  236. package/dist/types/components/modals/transition-view.d.ts.map +1 -0
  237. package/dist/types/components/modals/use-modal-with-views.d.ts +2 -1
  238. package/dist/types/components/modals/use-modal-with-views.d.ts.map +1 -1
  239. package/dist/types/components/wallet-selector/domain.d.ts +1 -1
  240. package/dist/types/components/wallet-selector/domain.d.ts.map +1 -1
  241. package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts +1 -1
  242. package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts.map +1 -1
  243. package/dist/types/config.d.ts +1 -0
  244. package/dist/types/config.d.ts.map +1 -1
  245. package/dist/types/integrations/bitcoin-metamask.d.ts +11 -0
  246. package/dist/types/integrations/bitcoin-metamask.d.ts.map +1 -0
  247. package/dist/types/integrations/bitcoin-network.d.ts +13 -0
  248. package/dist/types/integrations/bitcoin-network.d.ts.map +1 -0
  249. package/dist/types/integrations/bitcoin-psbt.d.ts +5 -0
  250. package/dist/types/integrations/bitcoin-psbt.d.ts.map +1 -0
  251. package/dist/types/integrations/bitcoin-source.d.ts +12 -0
  252. package/dist/types/integrations/bitcoin-source.d.ts.map +1 -0
  253. package/dist/types/integrations/bitcoin-wallet.d.ts +63 -0
  254. package/dist/types/integrations/bitcoin-wallet.d.ts.map +1 -0
  255. package/dist/types/integrations/evm-chain.d.ts +5 -0
  256. package/dist/types/integrations/evm-chain.d.ts.map +1 -1
  257. package/dist/types/integrations/guarded-wallet-client.d.ts +4 -0
  258. package/dist/types/integrations/guarded-wallet-client.d.ts.map +1 -0
  259. package/dist/types/integrations/lifi.d.ts +22 -0
  260. package/dist/types/integrations/lifi.d.ts.map +1 -1
  261. package/dist/types/refund/index.d.ts +1 -1
  262. package/dist/types/refund/index.d.ts.map +1 -1
  263. package/dist/types/state/checkout/bitcoin-payment.d.ts +28 -0
  264. package/dist/types/state/checkout/bitcoin-payment.d.ts.map +1 -0
  265. package/dist/types/state/checkout/checkout-state.d.ts +42 -10
  266. package/dist/types/state/checkout/checkout-state.d.ts.map +1 -1
  267. package/dist/types/state/checkout/funding.d.ts +6 -0
  268. package/dist/types/state/checkout/funding.d.ts.map +1 -0
  269. package/dist/types/state/checkout/issuance-conflicts.d.ts +22 -0
  270. package/dist/types/state/checkout/issuance-conflicts.d.ts.map +1 -0
  271. package/dist/types/state/checkout/manual-route.d.ts +13 -0
  272. package/dist/types/state/checkout/manual-route.d.ts.map +1 -0
  273. package/dist/types/state/checkout/payment-attempt.d.ts +19 -1
  274. package/dist/types/state/checkout/payment-attempt.d.ts.map +1 -1
  275. package/dist/types/state/checkout/payment-lifecycle.d.ts +6 -8
  276. package/dist/types/state/checkout/payment-lifecycle.d.ts.map +1 -1
  277. package/dist/types/state/checkout/payment-observer.d.ts +41 -0
  278. package/dist/types/state/checkout/payment-observer.d.ts.map +1 -0
  279. package/dist/types/state/checkout/payment-phase.d.ts +116 -0
  280. package/dist/types/state/checkout/payment-phase.d.ts.map +1 -0
  281. package/dist/types/state/checkout/quote-countdown.d.ts +15 -0
  282. package/dist/types/state/checkout/quote-countdown.d.ts.map +1 -0
  283. package/dist/types/state/checkout/quote-lifecycle.d.ts +17 -6
  284. package/dist/types/state/checkout/quote-lifecycle.d.ts.map +1 -1
  285. package/dist/types/state/checkout/route-estimate.d.ts +38 -0
  286. package/dist/types/state/checkout/route-estimate.d.ts.map +1 -0
  287. package/dist/types/state/checkout/store.d.ts +25 -10
  288. package/dist/types/state/checkout/store.d.ts.map +1 -1
  289. package/dist/types/state/checkout/wallet-payment.d.ts +13 -2
  290. package/dist/types/state/checkout/wallet-payment.d.ts.map +1 -1
  291. package/dist/types/utils/string.d.ts +2 -0
  292. package/dist/types/utils/string.d.ts.map +1 -1
  293. package/dist/types/utils/token-amount.d.ts +18 -0
  294. package/dist/types/utils/token-amount.d.ts.map +1 -0
  295. package/dist/types/utils/wallet-errors.d.ts.map +1 -1
  296. package/package.json +3 -1
  297. package/dist/esm/refund/confirmation.js +0 -30
  298. package/dist/esm/refund/confirmation.js.map +0 -1
  299. package/dist/types/refund/confirmation.d.ts +0 -14
  300. package/dist/types/refund/confirmation.d.ts.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { type Payment } from "../../api/types.js";
2
+ type PhaseFacts = {
3
+ /** A test payment, or one of a test checkout: its outcome is simulated. */
4
+ test: boolean;
5
+ /** Instructions were issued: the payment holds its only attempt. */
6
+ issued: boolean;
7
+ /** The issued instructions are a Relay deposit address. */
8
+ relay: boolean;
9
+ /** Relay failed or refunded the current request, so it delivers nothing. */
10
+ relayFailed: boolean;
11
+ /** The settlement cutoff passed: the payment accepts no more funds. */
12
+ cutoffPassed: boolean;
13
+ /**
14
+ * A wallet broadcast the payer's transfer: the API recorded it, or this
15
+ * checkout holds a broadcast it has not reported yet.
16
+ */
17
+ broadcast: boolean;
18
+ };
19
+ /**
20
+ * Where a payment stands for the buyer, from the API's payment alone. The
21
+ * pending phases split by what reached the payment: nothing (and what Relay
22
+ * says about the deposit), part of the amount due, or all of it. The others
23
+ * follow the payment's status.
24
+ */
25
+ export type PaymentPhase = PhaseFacts & ({
26
+ kind: "unissued";
27
+ }
28
+ /** Nothing received; Relay, if any, still waits for the deposit. */
29
+ | {
30
+ kind: "awaiting_deposit";
31
+ }
32
+ /** Nothing received yet; Relay is delivering or delivered the deposit. */
33
+ | {
34
+ kind: "relay_delivering";
35
+ }
36
+ /** Nothing received, and the Relay request failed or was refunded. */
37
+ | {
38
+ kind: "relay_delivered_nothing";
39
+ providerStatus: "failed" | "refund_pending";
40
+ }
41
+ /** Part of the amount due arrived; the API's shortfall is still needed. */
42
+ | {
43
+ kind: "partly_funded";
44
+ shortfall: string;
45
+ }
46
+ /** The amount due arrived; the scan moves the payment on. */
47
+ | {
48
+ kind: "funded";
49
+ }
50
+ /** Funds arrived and settlement is under way. */
51
+ | {
52
+ kind: "settling";
53
+ status: "confirming_payment" | "deferred" | "refund_pending";
54
+ } | {
55
+ kind: "refundable";
56
+ } | {
57
+ kind: "paid";
58
+ } | {
59
+ kind: "failed";
60
+ });
61
+ export type PaymentPhaseKind = PaymentPhase["kind"];
62
+ export type PaymentPhaseContext = {
63
+ /** The time the settlement cutoff is compared with. */
64
+ now?: number;
65
+ /** This checkout holds a wallet broadcast the API may not have recorded. */
66
+ walletBroadcast?: boolean;
67
+ };
68
+ type PhasePayment = Pick<Payment, "status"> & Partial<Pick<Payment, "is_test" | "checkout" | "payment_attempt" | "funding" | "timeline">>;
69
+ export declare const derivePaymentPhase: (payment: PhasePayment | null | undefined, { now, walletBroadcast }?: PaymentPhaseContext) => PaymentPhase;
70
+ /** The payment is still pending: no status view owns it yet. */
71
+ export declare const isPendingPhase: (phase: PaymentPhase) => boolean;
72
+ /**
73
+ * The payment still accepts funds: pending, short of the amount due and
74
+ * before the settlement cutoff.
75
+ */
76
+ export declare const acceptsFunds: (phase: PaymentPhase) => boolean;
77
+ /**
78
+ * A pending live payment with issued instructions that has received nothing,
79
+ * while Relay, if any, still waits. Only the chain scanner moves a payment on,
80
+ * seconds to minutes after funds land, so a payer whose wallet submitted the
81
+ * transfer or who confirmed sending may be waiting for it, or may have
82
+ * confirmed too early.
83
+ */
84
+ export declare const isAwaitingDeposit: (phase: PaymentPhase) => boolean;
85
+ /** The API's shortfall of a partly funded payment, else null. */
86
+ export declare const pendingShortfall: (phase: PaymentPhase) => string | null;
87
+ /**
88
+ * Pending and holding funds, whether part of the amount due or all of it:
89
+ * after the cutoff the payer waits for their refund.
90
+ */
91
+ export declare const holdsPendingFunds: (phase: PaymentPhase) => boolean;
92
+ /**
93
+ * Whether the checkout reads the payment at all: a test payment's outcome is
94
+ * simulated, and nothing reaches an unissued one.
95
+ */
96
+ export declare const isFollowedPhase: (phase: PaymentPhase) => boolean;
97
+ /**
98
+ * How often a followed payment is read: every 5 seconds while it is open or
99
+ * in flight, every 30 once it is terminal (paid, refundable or failed), so
100
+ * late deposits and claims still show.
101
+ */
102
+ export declare const paymentReadInterval: (phase: PaymentPhase) => number;
103
+ /**
104
+ * Whether the payment's own state, rather than the payer's navigation, puts
105
+ * them on the payment status view. A method or instruction view would offer to
106
+ * pay the full amount again, or show instructions the API no longer accepts:
107
+ * - a failed payment: the API never issues it again, test payments included;
108
+ * - a pending payment whose transfer a wallet broadcast, until it arrives;
109
+ * - a Relay deposit in delivery, or any payment holding funds (a test payment
110
+ * only when Relay delivered them);
111
+ * - a payment that moved on, except on a first opening with nothing saved of
112
+ * a direct payment, which keeps the method picker (`navigated` false).
113
+ */
114
+ export declare const belongsOnStatusView: (phase: PaymentPhase, navigated: boolean) => boolean;
115
+ export {};
116
+ //# sourceMappingURL=payment-phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-phase.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/payment-phase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAi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C5E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GACzC,OAAO,CACL,IAAI,CACF,OAAO,EACP,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,SAAS,GAAG,UAAU,CACpE,CACF,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAC7B,SAAS,YAAY,GAAG,IAAI,GAAG,SAAS,EACxC,2BAA+C,mBAAwB,KACtE,YAqDF,CAAC;AAWF,gEAAgE;AAChE,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,KAAG,OACrB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,KAAG,OACsB,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,KAAG,OACN,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,KAAG,MAAM,GAAG,IACP,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,KAAG,OACG,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,YAAY,KAAG,OACzB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,YAAY,KAAG,MAKvB,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,YAAY,EACnB,WAAW,OAAO,KACjB,OAiBF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { QuoteState } from "./checkout-state.js";
2
+ import type { CryptoPaymentAttempt } from "../../api/types.js";
3
+ /** The share of the window left when the countdown turns urgent. */
4
+ export declare const QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO = 0.25;
5
+ /**
6
+ * What the quote countdown shows, from one timing source. The quote
7
+ * lifecycle's countdown leads; it ticks with the quote's own expiry timer.
8
+ * Shown instructions whose quote has no countdown yet fall back to the issued
9
+ * attempt's expiry, ticking every second only while that fallback is shown.
10
+ */
11
+ export declare const useQuoteCountdown: (quote: Pick<QuoteState, "remainingMs" | "totalDurationMs">, issuedAttempt?: CryptoPaymentAttempt | null) => {
12
+ remainingMs: number | null;
13
+ totalDurationMs: number | null;
14
+ };
15
+ //# sourceMappingURL=quote-countdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote-countdown.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/quote-countdown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,oEAAoE;AACpE,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,iBAAiB,CAAC,EAC1D,gBAAe,oBAAoB,GAAG,IAAW;;;CAoBlD,CAAC"}
@@ -1,20 +1,31 @@
1
- import { type CheckoutState, type ManualAttemptOptions } from "./checkout-state.js";
1
+ import { type BrowsingQuote, type CheckoutState, type ManualAttemptOptions } from "./checkout-state.js";
2
2
  import type { CryptoPaymentAttempt, Payment } from "../../api/types.js";
3
- import type { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
3
+ import type { WalletPaymentOption } from "../../config.js";
4
+ /** A browsing price for the selected wallet route and when it stops being current. */
5
+ export type PricedWalletQuote = {
6
+ quote: BrowsingQuote;
7
+ expiresAt: number | null;
8
+ };
4
9
  interface QuoteDependencies {
5
10
  get: () => CheckoutState;
6
11
  set: (update: (state: CheckoutState) => void) => void;
7
12
  captureOpening: (additional?: () => boolean) => () => boolean;
8
- createWalletAttempt: (option: WalletPaymentOption, address: string, quote?: WalletPaymentQuote | null, ownsQuote?: () => boolean) => Promise<CryptoPaymentAttempt>;
13
+ /** Prices the selected wallet route through the estimate endpoint; never issues. */
14
+ priceWalletRoute: (option: WalletPaymentOption, walletAddress: string, ownsQuote: () => boolean) => Promise<PricedWalletQuote>;
15
+ /**
16
+ * Issues manual instructions. On PAYMENT_REQUIRES_NEW_LINK it has read the
17
+ * payment again before it rejects.
18
+ */
9
19
  createManualAttempt: (address: string, confirmations: number, refundTo: string | null, options: ManualAttemptOptions, ownsQuote: () => boolean) => Promise<CryptoPaymentAttempt>;
10
20
  }
11
- export declare const createQuoteLifecycle: ({ get, set, captureOpening, createWalletAttempt, createManualAttempt, }: QuoteDependencies) => {
21
+ export declare const createQuoteLifecycle: ({ get, set, captureOpening, priceWalletRoute, createManualAttempt, }: QuoteDependencies) => {
12
22
  dispose: () => void;
13
23
  getWalletQuoteRequestId: () => string;
14
- setWalletPaymentQuote: (data: WalletPaymentQuote) => void;
24
+ clearWalletQuoteRequestId: (id: string) => void;
25
+ beginBitcoinWalletPreparation: () => () => boolean;
26
+ setWalletPaymentQuote: (data: BrowsingQuote) => void;
15
27
  refreshQuote: (ownsConnection?: () => boolean) => Promise<void>;
16
28
  syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void;
17
- configureWalletQuoteRefresh: (walletAddress: string | null) => void;
18
29
  configureManualQuoteRefresh: () => void;
19
30
  prepareWalletQuoteReplacement: (walletAddress?: string | null, selectedOptionId?: string | null) => void;
20
31
  clearQuoteRefresh: (options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"quote-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/quote-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CA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OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,aAAa,CAAC;IACzB,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,KAAK,IAAI,CAAC;IACtD,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;IAC9D,oFAAoF;IACpF,gBAAgB,EAAE,CAChB,MAAM,EAAE,mBAAmB,EAC3B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,OAAO,KACrB,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC;;;OAGG;IACH,mBAAmB,EAAE,CACnB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,MAAM,OAAO,KACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC;AAOD,eAAO,MAAM,oBAAoB,GAAI,sEAMlC,iBAAiB;;;oCAwBqB,MAAM;;kCAmER,aAAa;oCAoJL,MAAM,OAAO;yBAiG/C,OAAO,GAAG,IAAI,YACb,oBAAoB,GAAG,IAAI;;oDA0BtB,MAAM,GAAG,IAAI;kCAyBnB;QAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE;4CAmB7B,MAAM,kBACL,MAAM,OAAO;6CAkBd,MAAM,WACZ,mBAAmB,EAAE;;CA2BjC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { PricedWalletQuote } from "./quote-lifecycle.js";
2
+ import type { CryptoCurrency, CryptoPayEstimate, CryptoPaymentAttempt } from "../../api/types.js";
3
+ import type { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
4
+ import type { WalletRouteQuoteTarget } from "../../integrations/lifi.js";
5
+ type SettlementAsset = Pick<CryptoCurrency, "asset" | "chain" | "asset_name">;
6
+ type IssuedAttempt = Pick<CryptoPaymentAttempt, "amount" | "amount_formatted" | "destination_address" | "settlement_token_address" | "settlement_config">;
7
+ /** A wallet estimate with its settlement amount in display units, when known. */
8
+ export type PricedRoute = {
9
+ estimate: CryptoPayEstimate;
10
+ /** The settlement amount this instruction should deliver. */
11
+ amountFormatted: string | null;
12
+ /** When the estimate stops being current (`quote_expires_at`). */
13
+ expiresAt: number | null;
14
+ };
15
+ export declare function priceBitcoinWalletEstimate(estimate: CryptoPayEstimate): PricedWalletQuote;
16
+ /**
17
+ * Formats an estimate's base units. An issued payment's attempt already
18
+ * carries the formatted amount due; otherwise the public token list gives the
19
+ * decimals. Nothing is computed beyond unit conversion.
20
+ */
21
+ export declare function priceEstimate(estimate: CryptoPayEstimate, settlement: Pick<CryptoCurrency, "asset" | "chain">, attempt: Pick<CryptoPaymentAttempt, "amount" | "amount_formatted"> | null): Promise<PricedRoute>;
22
+ /**
23
+ * Where a routed wallet quote delivers. An issued payment targets its
24
+ * splitter; an unissued one has none yet, so the payer's address stands in
25
+ * for a price-only quote and Pay quotes the issued splitter again.
26
+ */
27
+ export declare function buildWalletQuoteTarget(args: {
28
+ priced: PricedRoute;
29
+ attempt: IssuedAttempt | null;
30
+ settlement: SettlementAsset & {
31
+ chain_hex?: string | null;
32
+ };
33
+ walletAddress: string;
34
+ }): WalletRouteQuoteTarget;
35
+ /** The browsing quote shown for a direct route: the estimated amount due. */
36
+ export declare function buildDirectWalletQuote(option: WalletPaymentOption, priced: PricedRoute): WalletPaymentQuote;
37
+ export {};
38
+ //# sourceMappingURL=route-estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-estimate.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/route-estimate.ts"],"names":[],"m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I,CAAA;KAAE,CAAC;IAC5D,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,sBAAsB,CAuBzB;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,WAAW,GAClB,kBAAkB,CAapB"}
@@ -1,7 +1,8 @@
1
- import { Checkout, CheckoutMethod, CryptoCurrency, Payment, CryptoPaymentAttempt, PaymentStatus } from "../../api/types.js";
1
+ import { Checkout, CheckoutMethod, CryptoCurrency, Payment, CryptoPaymentAttempt } from "../../api/types.js";
2
2
  import { WalletInterface, Transfer } from "../../components/wallet-selector/domain.js";
3
3
  import { WalletPaymentOption, WalletPaymentQuote } from "../../config.js";
4
4
  import { type CheckoutState, type WalletPaymentUpdate, type ManualAttemptOptions } from "./checkout-state.js";
5
+ import { type PricedWalletQuote } from "./quote-lifecycle.js";
5
6
  export { ACTIONS } from "./checkout-state.js";
6
7
  export declare const useCheckoutStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<CheckoutState>, "setState"> & {
7
8
  setState(nextStateOrUpdater: CheckoutState | Partial<CheckoutState> | ((state: import("immer").WritableDraft<CheckoutState>) => void), shouldReplace?: false): void;
@@ -9,34 +10,48 @@ export declare const useCheckoutStore: import("zustand").UseBoundStore<Omit<impo
9
10
  }>;
10
11
  export declare const captureCheckoutOpening: (additional?: () => boolean) => () => boolean;
11
12
  export declare const beginCheckoutOpening: () => () => void;
12
- export declare const refreshQuote: (ownsConnection?: () => boolean) => Promise<void>, syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void, configureWalletQuoteRefresh: (walletAddress: string | null) => void, configureManualQuoteRefresh: () => void, prepareWalletQuoteReplacement: (walletAddress?: string | null, selectedOptionId?: string | null) => void, clearQuoteRefresh: (options?: {
13
+ export declare const refreshQuote: (ownsConnection?: () => boolean) => Promise<void>, syncQuote: (payment: Payment | null, attempt?: CryptoPaymentAttempt | null) => void, configureManualQuoteRefresh: () => void, prepareWalletQuoteReplacement: (walletAddress?: string | null, selectedOptionId?: string | null) => void, clearQuoteRefresh: (options?: {
13
14
  preserveWalletAddress?: boolean;
14
- }) => void, loadWalletPaymentQuote: (walletAddress: string, ownsConnection: () => boolean) => Promise<void>, setWalletPaymentOptions: (walletAddress: string, options: WalletPaymentOption[]) => void, resetWalletPaymentState: () => void, setWalletPaymentQuote: (data: WalletPaymentQuote) => void;
15
+ }) => void, loadWalletPaymentQuote: (walletAddress: string, ownsConnection: () => boolean) => Promise<void>, setWalletPaymentOptions: (walletAddress: string, options: WalletPaymentOption[]) => void, resetWalletPaymentState: () => void, beginBitcoinWalletPreparation: () => () => boolean, setWalletPaymentQuote: (data: import("./checkout-state.js").BrowsingQuote) => void;
16
+ /**
17
+ * A payment is issued once its only attempt exists (QCT D1). From then on its
18
+ * terms, including the refund recipient, are fixed.
19
+ */
20
+ export declare const isCheckoutIssued: (state?: CheckoutState) => boolean;
21
+ /** The refund recipient frozen at issuance, or null before issuance. */
22
+ export declare const getFrozenRefundRecipient: (state?: CheckoutState) => string | null;
23
+ export declare const assertWalletAttemptCurrent: (attempt: CryptoPaymentAttempt) => void;
24
+ export declare const followPayment: ({ readNow, onRead }: {
25
+ readNow: boolean;
26
+ onRead?: () => void;
27
+ }) => {
28
+ stop: () => void;
29
+ };
15
30
  export declare const clearErrors: () => void;
16
31
  export declare const initialiseStore: (payment: Payment) => Promise<void>;
17
32
  export declare const createWalletOptionPaymentAttempt: (option: WalletPaymentOption, sendingAddress: string, quote?: WalletPaymentQuote | null, ownsWallet?: () => boolean) => Promise<CryptoPaymentAttempt>;
18
33
  export declare const createManualDirectPaymentAttempt: (sendingAddress?: string, confirmations?: number, refundTo?: string | null, options?: ManualAttemptOptions, ownsQuote?: () => boolean) => Promise<CryptoPaymentAttempt>;
34
+ /** Prices a selected wallet route without issuing payment instructions. */
35
+ export declare const priceWalletRoute: (option: WalletPaymentOption, walletAddress: string, ownsQuote?: () => boolean) => Promise<PricedWalletQuote>;
19
36
  export declare const createSuccessfulTestPaymentAttempt: () => Promise<void>;
20
37
  export declare const createFailedTestPaymentAttempt: () => Promise<void>;
21
38
  export declare function getAvailableCheckoutMethods(checkout: Checkout): CheckoutMethod[];
22
39
  export declare const hydrateCheckoutFromPayment: (payment: Payment) => void;
23
- export declare const getPayment: () => Promise<Payment | null>;
24
40
  interface TransferWalletInterface {
25
41
  getAddress(): Promise<string | null>;
26
- executeTransfer(config: Transfer): Promise<string | null>;
42
+ executeTransfer(config: Transfer, beforeSign?: () => void): Promise<string | null>;
27
43
  switchChain?(chainId: number): Promise<void>;
28
44
  }
29
- export declare const executeTransfer: (wallet: TransferWalletInterface, ownsWallet?: () => boolean) => Promise<string | null>;
45
+ export declare const executeTransfer: (wallet: TransferWalletInterface, ownsWallet?: () => boolean, beforeSign?: () => void) => Promise<string | null>;
46
+ export declare class TransferRevertedError extends Error {
47
+ constructor();
48
+ }
30
49
  export declare const checkChainStatus: (wallet: WalletInterface, submitted?: {
31
50
  hash: string;
32
51
  chainId: number;
33
52
  canUpdate: () => boolean;
34
53
  }) => Promise<void>;
35
54
  export declare const resetTransfer: () => void;
36
- export declare const startPaymentPolling: (onPaymentStatusChange: (status: PaymentStatus) => void, confirmationStatus?: PaymentStatus) => {
37
- stop: () => void;
38
- };
39
- export declare const stopPaymentPolling: () => void;
40
55
  export declare const resetCheckoutStore: (payment?: Payment | null) => void;
41
56
  export declare const resetCheckoutSessionForRetry: () => void;
42
57
  export declare const setCheckoutMethod: (method: CheckoutMethod) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/store.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,QAAQ,EACT,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,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BAAkB,GAAI,UAAS,OAAO,GAAG,IAAW,SAShE,CAAC;AAEF,eAAO,MAAM,4BAA4B,YAyBxC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,cAAc,SAIvD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,OAAO,SAIhD,CAAC;AAEF,eAAO,MAAM,aAAa,eAEzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,UAAU,cAAc,GAAG,IAAI,SAIlE,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,OAQ7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,QAAQ,mBAAmB,SAIhE,CAAC"}
@@ -1,12 +1,23 @@
1
1
  import type { WagmiWalletInterface } from "../../components/wallet-selector/wallets/wagmi/index.js";
2
+ import type { ConnectedBitcoinWallet } from "../../integrations/bitcoin-wallet.js";
2
3
  export declare function loadWalletPaymentOptions(address: string, ownsConnection: () => boolean, force?: boolean): Promise<void>;
3
- type WalletPaymentSession = {
4
+ /** The connected wallet that signs a payment: an EVM or a Bitcoin wallet. */
5
+ export type PaymentWallet = {
4
6
  wallet: WagmiWalletInterface;
7
+ bitcoin?: never;
8
+ } | {
9
+ wallet?: never;
10
+ bitcoin: ConnectedBitcoinWallet;
11
+ };
12
+ type WalletPaymentSession = PaymentWallet & {
5
13
  address: string;
6
14
  ownsConnection: () => boolean;
7
15
  onStatusChange: (status: "submitted" | "failed") => void;
8
16
  };
9
- /** Captures the originating payment before any wallet or provider work. */
17
+ /**
18
+ * Pay is the wallet flow's only issuing call (QCT D7). It captures the
19
+ * originating payment before any wallet or provider work.
20
+ */
10
21
  export declare function payWithWallet(session: WalletPaymentSession): Promise<void>;
11
22
  export declare function retryWalletPayment(session: WalletPaymentSession): Promise<void>;
12
23
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-payment.d.ts","sourceRoot":"","sources":["../../../../src/state/checkout/wallet-payment.ts"],"names":[],"mappings":"AAsBA,OAAO,KAA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,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,iBA2MhE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,iBAI/D"}
@@ -21,4 +21,6 @@
21
21
  */
22
22
  export declare const formatAmountForDisplay: (amount: string) => string;
23
23
  export declare const formatAddress: (address: string) => string;
24
+ /** The shorter form used inside sentences: `0x1234...abcd`. */
25
+ export declare const formatShortAddress: (address: string) => string;
24
26
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,WAOpD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MACC,CAAC"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,WAOpD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MACC,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Exact display units for a base-unit amount, or `null` when unknown. */
2
+ export declare function formatBaseUnits(rawAmount: string | null | undefined, decimals: number | null | undefined): string | null;
3
+ /** A compact display amount: at most six fraction digits, at least two. */
4
+ export declare function formatTokenAmount(rawAmount: string, decimals: number): string;
5
+ export declare function formatChainLabel(chain: string): string;
6
+ export declare function formatTokenLabel(token: string): string;
7
+ /** Token decimals when the API omits them: known tokens, else 18. */
8
+ export declare function fallbackTokenDecimals(token: string): number;
9
+ /** `1.50 USDC`: base units in display units, with the token's symbol. */
10
+ export declare function formatTokenValue(rawAmount: string, token: string, decimals?: number | null, symbol?: string | null): string;
11
+ export declare function formatRefundAmount(refund: {
12
+ current_refundable_balance: string;
13
+ token: string;
14
+ token_decimals?: number | null;
15
+ token_symbol?: string | null;
16
+ }): string;
17
+ export declare function transactionUrl(chain: string, transactionHash: string): string | null;
18
+ //# sourceMappingURL=token-amount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-amount.d.ts","sourceRoot":"","sources":["../../../src/utils/token-amount.ts"],"names":[],"mappings":"AAQA,0EAA0E;AAC1E,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,MAAM,GAAG,IAAI,CAOf;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB7E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYtD;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,MAAM,CAER;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,0BAA0B,EAAE,MAAM,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,MAAM,CAOT;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,MAAM,GAAG,IAAI,CASf"}
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/wallet-errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,UAAU,MAAM,KACf,MAgBF,CAAC"}
1
+ {"version":3,"file":"wallet-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/wallet-errors.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,UAAU,MAAM,KACf,MA+BF,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mintmoney/react",
3
3
  "description": "React SDK library for the MintMoney payments network",
4
- "version": "0.2.0-alpha.2",
4
+ "version": "0.2.0-alpha.3",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -91,9 +91,11 @@
91
91
  "@radix-ui/react-dialog": "^1.1.6",
92
92
  "@radix-ui/react-visually-hidden": "^1.1.2",
93
93
  "@reown/appkit": "^1.8.19",
94
+ "@reown/appkit-adapter-bitcoin": "1.8.19",
94
95
  "@reown/appkit-adapter-wagmi": "^1.8.19",
95
96
  "@tanstack/react-query": "^5.76.1",
96
97
  "@wagmi/core": "^2.22.1",
98
+ "bitcoinjs-lib": "7.0.5",
97
99
  "clsx": "^2.1.1",
98
100
  "ethers": "^6.13.5",
99
101
  "immer": "^10.0.0",
@@ -1,30 +0,0 @@
1
- import { confirmPaymentRefund } from "../api/payments.js";
2
- const CONFIRMATION_TIMEOUT_MS = 120_000;
3
- const CONFIRMATION_POLL_INTERVAL_MS = 3_000;
4
- const wait = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
5
- /**
6
- * The backend is the canonical chain observer. Poll it after wallet submission
7
- * instead of coupling the checkout to the wallet provider's RPC endpoint.
8
- */
9
- export async function waitForRefundConfirmation(paymentId, { transactionHash, attemptId, connectedAddress, apiUrl, }) {
10
- const deadline = Date.now() + CONFIRMATION_TIMEOUT_MS;
11
- let lastError;
12
- while (Date.now() < deadline) {
13
- try {
14
- return await confirmPaymentRefund(paymentId, {
15
- transactionHash,
16
- attemptId,
17
- connectedAddress,
18
- apiUrl,
19
- });
20
- }
21
- catch (error) {
22
- lastError = error;
23
- await wait(CONFIRMATION_POLL_INTERVAL_MS);
24
- }
25
- }
26
- throw lastError instanceof Error
27
- ? lastError
28
- : new Error("Refund transaction is still awaiting confirmation.");
29
- }
30
- //# sourceMappingURL=confirmation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"confirmation.js","sourceRoot":"","sources":["../../../src/refund/confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAM1D,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAE5C,MAAM,IAAI,GAAG,CAAC,YAAoB,EAAE,EAAE,CACpC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,SAAiB,EACjB,EACE,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,MAAM,GAMP;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,uBAAuB,CAAC;IACtD,IAAI,SAAkB,CAAC;IAEvB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,OAAO,MAAM,oBAAoB,CAAC,SAAS,EAAE;gBAC3C,eAAe;gBACf,SAAS;gBACT,gBAAgB;gBAChB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;YAClB,MAAM,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,MAAM,SAAS,YAAY,KAAK;QAC9B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;AACtE,CAAC"}
@@ -1,14 +0,0 @@
1
- import type { PaymentsCryptoPayRefundDetailData } from "../api/generated.js";
2
- type RefundStatus = PaymentsCryptoPayRefundDetailData["data"];
3
- /**
4
- * The backend is the canonical chain observer. Poll it after wallet submission
5
- * instead of coupling the checkout to the wallet provider's RPC endpoint.
6
- */
7
- export declare function waitForRefundConfirmation(paymentId: string, { transactionHash, attemptId, connectedAddress, apiUrl, }: {
8
- transactionHash: string;
9
- attemptId: string;
10
- connectedAddress: string;
11
- apiUrl?: string;
12
- }): Promise<RefundStatus>;
13
- export {};
14
- //# sourceMappingURL=confirmation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../src/refund/confirmation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE7E,KAAK,YAAY,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAC;AAQ9D;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,EACE,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,MAAM,GACP,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,YAAY,CAAC,CAqBvB"}